Skip to content

Commit 85ff2a0

Browse files
committed
added evaluatedHttpCalls and executionTimeInSeconds. renamed totalHttpCalls into outputHttpCalls
1 parent 28e37f6 commit 85ff2a0

7 files changed

Lines changed: 45 additions & 14 deletions

File tree

src/main/resources/wfc/schemas/report.yaml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,28 @@ properties:
4848
type: array
4949
items:
5050
$ref: "#/$defs/TestCase"
51+
executionTimeInSeconds:
52+
type: integer
53+
minimum: 0
54+
description: "For how long, in seconds, the tool was running in total."
5155
#OPTIONAL
5256
extra:
5357
description: "Extra, optional coverage information, collected by different tools."
5458
type: [array, "null"]
5559
items:
5660
$ref: "#/$defs/Coverage"
5761

58-
required: ["schemaVersion","toolName","toolVersion","creationTime","faults","problemDetails","totalTests","testFilePaths","testCases"]
62+
required:
63+
- "schemaVersion"
64+
- "toolName"
65+
- "toolVersion"
66+
- "creationTime"
67+
- "faults"
68+
- "problemDetails"
69+
- "totalTests"
70+
- "testFilePaths"
71+
- "testCases"
72+
- "executionTimeInSeconds"
5973

6074
$defs:
6175
OperationId:
@@ -122,11 +136,18 @@ $defs:
122136
RESTReport:
123137
type: object
124138
properties:
125-
totalHttpCalls:
126-
description: "Total number of HTTP calls made in all the test cases. A test case could contain several HTTP calls, \
139+
outputHttpCalls:
140+
description: "Total number of HTTP calls made in all the generated test cases given as output. \
141+
A test case could contain several HTTP calls, \
127142
e.g., a POST followed by a GET and then a DELETE."
128143
type: integer
129144
minimum: 0
145+
evaluatedHttpCalls:
146+
description: "Total number of all HTTP calls made during the whole fuzzing session. \
147+
If the fuzzing was left running for hours, millions of HTTP could have been made.
148+
The output generated tests will only contain a tiny subset of these evaluated calls."
149+
type: integer
150+
minimum: 0
130151
endpointIds:
131152
description: "Unique ids of all the endpoints in the tested API."
132153
type: array
@@ -138,7 +159,7 @@ $defs:
138159
type: array
139160
items:
140161
$ref: "#/$defs/CoveredEndpoint"
141-
required: ["totalHttpCalls","endpointIds","coveredHttpStatus"]
162+
required: ["outputHttpCalls","evaluatedHttpCalls","endpointIds","coveredHttpStatus"]
142163

143164
TestCase:
144165
type: object

web-report/src-e2e/App.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ describe('App test', () => {
7979
render(<App />);
8080
expect(screen.getByText(/Please wait, files are loading.../)).toBeInTheDocument();
8181
const total = reportData.problemDetails.rest.endpointIds.length;
82-
const totalHttpCalls = reportData.problemDetails.rest.totalHttpCalls;
82+
const outputHttpCalls = reportData.problemDetails.rest.outputHttpCalls;
8383

8484
await waitFor(() => {
8585
expect(screen.getByTestId('rest-report-endpoint')).toContainHTML(`${total}`);
86-
expect(screen.getByTestId('rest-report-http-calls')).toContainHTML(`${totalHttpCalls}`);
86+
expect(screen.getByTestId('rest-report-http-calls')).toContainHTML(`${outputHttpCalls}`);
8787
});
8888

8989
});

web-report/src-e2e/static/report.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,7 @@
29702970
},
29712971
"problemDetails": {
29722972
"rest": {
2973-
"totalHttpCalls": 130,
2973+
"outputHttpCalls": 130,
29742974
"endpointIds": [
29752975
"GET:/app/api/assignments",
29762976
"POST:/app/api/assignments",

web-report/src/components/GeneratedTests.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ interface IGeneratedTests {
1111
fileName: string,
1212
numberOfTestCases: number
1313
}>
14-
totalHttpCalls?: number
14+
outputHttpCalls?: number
1515
}
1616

17-
export const GeneratedTests: React.FC<IGeneratedTests> = ({totalTests, testFiles, totalHttpCalls}) => (
17+
export const GeneratedTests: React.FC<IGeneratedTests> = ({totalTests, testFiles, outputHttpCalls}) => (
1818
<Card className="border-2 border-black p-6 rounded-none">
1919
<div className="flex items-start gap-4">
2020
<Target className="w-6 h-6 text-gray-500"/>
@@ -35,7 +35,7 @@ export const GeneratedTests: React.FC<IGeneratedTests> = ({totalTests, testFiles
3535
<ReportTooltip tooltipText={info.numberOfHttpCalls}>
3636
<span className="text-lg font-bold"># HTTP Calls:</span>
3737
</ReportTooltip>
38-
<span className="text-lg font-bold" data-testid="rest-report-http-calls">{totalHttpCalls}</span>
38+
<span className="text-lg font-bold" data-testid="rest-report-http-calls">{outputHttpCalls}</span>
3939
</div>
4040

4141
<div className="mt-4 pt-4 border-t border-gray-200">

web-report/src/pages/Overview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Overview: React.FC<IOverviewType> = ({rest, testCases, testFiles, f
2222
{/* Right Panel */}
2323
<div className="flex flex-col gap-6">
2424
{/* Generated Tests */}
25-
<GeneratedTests totalTests={testCases.length} testFiles={testFiles} totalHttpCalls={rest?.totalHttpCalls}/>
25+
<GeneratedTests totalTests={testCases.length} testFiles={testFiles} outputHttpCalls={rest?.outputHttpCalls}/>
2626
{/* Faults */}
2727
<FaultsComponent {...faults}/>
2828
</div>

web-report/src/types/GeneratedTypes.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export interface WebFuzzingCommonsReport {
5656
* Information on each generated test case.
5757
*/
5858
testCases: TestCase[];
59+
/**
60+
* For how long, in seconds, the tool was running in total.
61+
*/
62+
executionTimeInSeconds: number;
5963
/**
6064
* Extra, optional coverage information, collected by different tools.
6165
*/
@@ -101,9 +105,13 @@ export interface FaultCategoryId {
101105
}
102106
export interface RESTReport {
103107
/**
104-
* Total number of HTTP calls made in all the test cases. A test case could contain several HTTP calls, e.g., a POST followed by a GET and then a DELETE.
108+
* Total number of HTTP calls made in all the generated test cases given as output. A test case could contain several HTTP calls, e.g., a POST followed by a GET and then a DELETE.
109+
*/
110+
outputHttpCalls: number;
111+
/**
112+
* Total number of all HTTP calls made during the whole fuzzing session. If the fuzzing was left running for hours, millions of HTTP could have been made. The output generated tests will only contain a tiny subset of these evaluated calls.
105113
*/
106-
totalHttpCalls: number;
114+
evaluatedHttpCalls: number;
107115
/**
108116
* Unique ids of all the endpoints in the tested API.
109117
*/

web-report/src/types/GeneratedTypesZod.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export const coverageCriterionSchema = z.record(z.unknown()).and(
4444

4545
export const rESTReportSchema = z.record(z.unknown()).and(
4646
z.object({
47-
totalHttpCalls: z.number(),
47+
outputHttpCalls: z.number(),
48+
evaluatedHttpCalls: z.number(),
4849
endpointIds: z.array(operationIdSchema),
4950
coveredHttpStatus: z.array(coveredEndpointSchema),
5051
}),
@@ -89,6 +90,7 @@ export const webFuzzingCommonsReportSchema = z.record(z.unknown()).and(
8990
totalTests: z.number(),
9091
testFilePaths: z.array(testFilePathSchema),
9192
testCases: z.array(testCaseSchema),
93+
executionTimeInSeconds: z.number(),
9294
extra: z.array(coverageSchema).optional().nullable(),
9395
}),
9496
);

0 commit comments

Comments
 (0)