Skip to content

Commit 21ca38f

Browse files
authored
Merge branch 'main' into main
2 parents 8239a40 + 6a8ec1a commit 21ca38f

File tree

6 files changed

+161
-47
lines changed

6 files changed

+161
-47
lines changed

src/components/EnterpriseInstallReminder.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
import React from "react";
22
import Link from "@docusaurus/Link";
3+
import {useColorMode} from "@docusaurus/theme-common";
34

45
export default function EnterpriseInstallReminder() {
6+
const {colorMode} = useColorMode();
7+
const isDark = colorMode === "dark";
8+
9+
const containerStyle = {
10+
padding: "1rem",
11+
border: isDark ? "1px solid #333" : "1px solid #eee",
12+
borderRadius: "10px",
13+
background: isDark ? "#23272f" : "#fff8f5",
14+
margin: "2rem 0",
15+
color: isDark ? "#fff" : "#222",
16+
boxShadow: isDark
17+
? "0 2px 10px rgba(0,0,0,0.6)"
18+
: "0 2px 6px rgba(0, 0, 0, 0.08)",
19+
};
20+
521
return (
6-
<div
7-
style={{
8-
padding: "1rem",
9-
border: "1px solid #eee",
10-
borderRadius: "10px",
11-
background: "#fff8f5",
12-
margin: "2rem 0",
13-
}}
14-
>
15-
<h3>Don’t have Keploy installed yet?</h3>
16-
<p>
22+
<div style={containerStyle}>
23+
<h3 style={{marginTop: 0, color: isDark ? "#fff" : "#222"}}>
24+
Don’t have Keploy installed yet?
25+
</h3>
26+
<p style={{color: isDark ? "#ccc" : undefined}}>
1727
Before running this sample, make sure Keploy Enterprise version is
1828
installed on your system.
1929
</p>

src/components/InstallReminder.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
import React from "react";
22
import Link from "@docusaurus/Link";
3+
import {useColorMode} from "@docusaurus/theme-common";
34

45
export default function InstallReminder() {
6+
const {colorMode} = useColorMode();
7+
const isDark = colorMode === "dark";
8+
9+
const containerStyle = {
10+
padding: "1rem",
11+
border: isDark ? "1px solid #333" : "1px solid #eee",
12+
borderRadius: "10px",
13+
background: isDark ? "#23272f" : "#fff8f5",
14+
margin: "2rem 0",
15+
color: isDark ? "#fff" : "#222",
16+
boxShadow: isDark
17+
? "0 2px 10px rgba(0,0,0,0.6)"
18+
: "0 2px 6px rgba(0, 0, 0, 0.08)",
19+
};
20+
521
return (
6-
<div
7-
style={{
8-
padding: "1rem",
9-
border: "1px solid #eee",
10-
borderRadius: "10px",
11-
background: "#fff8f5",
12-
margin: "2rem 0",
13-
}}
14-
>
15-
<h3>Don’t have Keploy installed yet?</h3>
16-
<p>
22+
<div style={containerStyle}>
23+
<h3 style={{marginTop: 0, color: isDark ? "#fff" : "#222"}}>
24+
Don’t have Keploy installed yet?
25+
</h3>
26+
<p style={{color: isDark ? "#ccc" : undefined}}>
1727
Before running this sample, make sure Keploy is installed on your
1828
system.
1929
</p>

versioned_docs/version-3.0.0/running-keploy/cli-commands.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ keploy gen [flags]
271271

272272
The `normalize` cmd in Keploy allows user to change the response of the testcases according to the latest test run response that is executed by the user, this is useful when the API response of the testcases are changed due to code change or any other intentional change in the application.
273273

274+
This command is now “risk-aware” to prevent accidental acceptance of breaking API changes. By default, it will automatically update tests that failed with Low or Medium risk, but it will refuse to normalize any test that failed with a High risk, printing a warning instead.
275+
274276
<b> Usage: </b>
275277

276278
```bash
@@ -299,6 +301,12 @@ keploy normalize [flags]
299301
keploy normalize -p "./tests" --test-run "test-run-10" --tests "test-set-1:test-case-1 test-case-2,test-set-2:test-case-1 test-case-2"
300302
```
301303

304+
- `--allow-high-risk` - Allow normalization of high-risk test failures. This flag overrides the default safe behavior and updates all failed tests, including those with breaking changes.
305+
306+
```bash
307+
keploy normalize --allow-high-risk
308+
```
309+
302310
## [rerecord](#rerecord)
303311

304312
The `rerecord` command allows users to record new Keploy test cases and mocks from existing test cases for the given testset(s).
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
id: risk-profile-analysis
3+
title: Risk Profile Analysis
4+
sidebar_label: Risk Profile Analysis
5+
description: Discover Keploy's Risk Profile Analysis feature, which automatically classifies API test failures as High, Medium, or Low risk, helping you instantly distinguish between breaking changes and minor updates.
6+
tags:
7+
- risk-analysis
8+
- change-management
9+
- breaking-changes
10+
keywords:
11+
- risk analysis
12+
- breaking changes
13+
- High Risk
14+
- Medium Risk
15+
- Low Risk
16+
- Risk Categories
17+
- Schema Changed
18+
- Schema Broken
19+
---
20+
21+
When API contracts change, tests are expected to fail. However, not all failures are equal. A minor, backward-compatible change (like adding a new optional field) is very different from a major, breaking change (like removing a field or changing a data type).
22+
23+
The **Risk Profile Analysis** feature addresses this by automatically categorizing each test failure based on its potential impact. It assigns a risk level of **High**, **Medium**, or **Low**, giving developers immediate insight into the severity and nature of API changes. This helps distinguish between intentional contract updates and unintentional bugs right from the test report.
24+
25+
### Key Concepts
26+
27+
When a test fails, it is now assigned a risk level:
28+
29+
- **HIGH**: Indicates a likely breaking change to the API contract. This is the highest level of risk.
30+
31+
- **Triggers**: Status code changes, `Content-Type` header changes, removing fields from a JSON body, or changing the data type of a field (e.g., string to number).
32+
33+
- **MEDIUM**: Indicates a change that might affect consumers but is not a direct contract violation.
34+
35+
- **Triggers**: Changes in header values (other than `Content-Type`), or changes to field values within a JSON body while new fields are also being added.
36+
37+
- **LOW**: Indicates a backward-compatible, non-breaking change.
38+
- **Triggers**: Only adding new, optional fields to a JSON body.
39+
40+
To provide more detail, failures are also assigned one or more categories:
41+
42+
- `SCHEMA_BROKEN`: A breaking change occurred in the response body (field removed, type changed).
43+
- `SCHEMA_ADDED`: Only new fields were added to the response body.
44+
- `SCHEMA_UNCHANGED`: The response body schema is identical, but values within it have changed.
45+
- `STATUS_CODE_CHANGED`: The HTTP status code was different from the expected one.
46+
- `HEADER_CHANGED`: One or more headers were different.
47+
48+
##### How Risk Profiling Works During Testing
49+
50+
1. **Failure Detection**: Keploy runs tests as usual. When a response mismatch is detected, the new analysis logic is triggered.
51+
2. **Deep Comparison**: Keploy performs a detailed comparison of the expected versus actual responses:
52+
- **Status Code**: Checks for any mismatch.
53+
- **Headers**: Pays special attention to the `Content-Type` header.
54+
- **JSON Body**: Analyzes the _nature_ of the difference by comparing the structure of the expected and actual JSON payloads to identify added fields, removed fields, and data type changes.
55+
3. **Risk Assessment**: Based on the comparison, a `RiskLevel` and one or more `FailureCategory` tags are assigned to the test result.
56+
4. **Enhanced Reporting**: The test report (`test-run-*-report.yaml`) is updated to include these new details. The summary now includes counts for high, medium, and low-risk failures, and each individual failed test specifies its risk and category.
57+
58+
**Example Test Report Snippet:**
59+
60+
```yaml
61+
version: 2.0.0
62+
name: test-set-0
63+
status: FAILED
64+
success: 0
65+
failure: 12
66+
high-risk: 7
67+
medium-risk: 4
68+
low-risk: 1
69+
total: 12
70+
tests:
71+
- name: test-1
72+
status: FAILED
73+
# ... other fields
74+
failure_info:
75+
risk: HIGH
76+
category:
77+
- SCHEMA_BROKEN
78+
- name: test-2
79+
status: FAILED
80+
# ... other fields
81+
failure_info:
82+
risk: LOW
83+
category:
84+
- SCHEMA_ADDED
85+
```

versioned_docs/version-3.0.0/server/installation_tabs.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,27 @@ brew install lima
157157

158158
3. **Create a Debian instance** \[or any instance of your choice]
159159

160-
```bash
161-
limactl create template://debian-12
162-
```
160+
```bash
161+
limactl create template://debian-12
162+
```
163163

164164
4. **Start the instance**
165165

166-
```bash
167-
limactl start debian-12
168-
```
166+
```bash
167+
limactl start debian-12
168+
```
169169

170170
5. **Enter the Linux shell**
171171

172-
```bash
173-
limactl shell debian-12
174-
```
172+
```bash
173+
limactl shell debian-12
174+
```
175175

176176
6. **Install Keploy inside Lima**
177177

178-
```bash
179-
curl --silent -O -L https://keploy.io/install.sh && source install.sh
180-
```
178+
```bash
179+
curl --silent -O -L https://keploy.io/install.sh && source install.sh
180+
```
181181

182182
7. **Once done, You should see something like this:**
183183

@@ -225,9 +225,9 @@ You’ve successfully set up **Keploy on macOS** using **Lima**.
225225

226226
2. **Install Keploy**
227227

228-
```bash
229-
curl --silent -O -L https://keploy.io/install.sh && source install.sh
230-
```
228+
```bash
229+
curl --silent -O -L https://keploy.io/install.sh && source install.sh
230+
```
231231

232232
3. **Verify the installation**
233233

@@ -296,19 +296,19 @@ Run the following command in PowerShell (as Administrator):
296296

297297
1. **Enable WSL**
298298

299-
```shell
300-
wsl --install -d <Distribution Name>
301-
```
299+
```shell
300+
wsl --install -d <Distribution Name>
301+
```
302302

303303
👉 We recommend using **Ubuntu-22.04** for the best experience.
304304
(You can also choose a different distribution if needed.)
305305

306306
2. **Install Keploy Binary**
307307
Inside your WSL terminal, run:
308308

309-
```shell
310-
curl --silent -O -L https://keploy.io/install.sh && source install.sh
311-
```
309+
```shell
310+
curl --silent -O -L https://keploy.io/install.sh && source install.sh
311+
```
312312

313313
3. **Verify Installation**
314314

@@ -356,9 +356,9 @@ You’ve successfully set up **Keploy on Windows** using **WSL**.
356356

357357
2. **Install Keploy**
358358

359-
```bash
360-
curl --silent -O -L https://keploy.io/install.sh && source install.sh
361-
```
359+
```bash
360+
curl --silent -O -L https://keploy.io/install.sh && source install.sh
361+
```
362362

363363
3. **Verify the installation**
364364

versioned_sidebars/version-3.0.0-sidebars.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
"running-keploy/docker-tls",
6464
"running-keploy/configuration-file",
6565
"running-keploy/custom-mocks",
66-
"running-keploy/keploy-templatize"
66+
"running-keploy/keploy-templatize",
67+
"running-keploy/risk-profile-analysis"
6768
]
6869
},
6970
{

0 commit comments

Comments
 (0)