{
// Test Cases
- test_cases.map((testCase, key) => (
+ testCases.map((testCase, key) => (
diff --git a/web-report/src/lib/utils.tsx b/web-report/src/lib/utils.tsx
index 737bc26..4509b3d 100644
--- a/web-report/src/lib/utils.tsx
+++ b/web-report/src/lib/utils.tsx
@@ -67,7 +67,7 @@ export const extractCodeLines = (
return lines.slice(startIndex, endIndex + 2).join('\n');
};
-export const calculateAllStatusCounts = (covered_http_status: CoveredEndpoint[], endpoint_ids:string[]) => {
+export const calculateAllStatusCounts = (coveredHttpStatus: CoveredEndpoint[], endpointIds:string[]) => {
const allStatusCounts ={
"2XX": 0,
"3XX": 0,
@@ -75,11 +75,11 @@ export const calculateAllStatusCounts = (covered_http_status: CoveredEndpoint[],
"5XX": 0
}
- endpoint_ids.map(
+ endpointIds.map(
(endpoint) => {
- const allStatusCodes = covered_http_status.filter(status => status.endpoint_id === endpoint)
+ const allStatusCodes = coveredHttpStatus.filter(status => status.endpointId === endpoint)
.map(
- (status) => status.http_status
+ (status) => status.httpStatus
).flat()
const uniqueStatusCodes = [...new Set(allStatusCodes)];
@@ -121,20 +121,20 @@ export const calculateAllStatusCounts = (covered_http_status: CoveredEndpoint[],
return allStatusCounts;
}
-export const getFaultCounts = (found_faults: FoundFault[]) => {
+export const getFaultCounts = (foundFaults: FoundFault[]) => {
const faultCounts = new Map();
- // A fault defines a unique operation_id, code, and context. To define a unique fault, we can use a combination of these three properties.
+ // A fault defines a unique operationId, code, and context. To define a unique fault, we can use a combination of these three properties.
- found_faults.forEach(fault => {
- fault.fault_categories.forEach(category => {
- faultCounts.set(`${fault.operation_id}|${category.code}|${category.context}`, (faultCounts.get(category.code) || 0) + 1);
+ foundFaults.forEach(fault => {
+ fault.faultCategories.forEach(category => {
+ faultCounts.set(`${fault.operationId}|${category.code}|${category.context}`, (faultCounts.get(category.code) || 0) + 1);
});
});
const uniqueFaults = Array.from(faultCounts.keys()).map(key => {
const [operationId, code, context] = key.split('|');
return {
- operation_id: operationId,
+ operationId: operationId,
code: parseInt(code, 10),
context: context || '',
count: faultCounts.get(key)
@@ -144,11 +144,11 @@ export const getFaultCounts = (found_faults: FoundFault[]) => {
return Array.from(uniqueCodes).map(code => {
const faultsWithCode = uniqueFaults.filter(fault => fault.code === code);
- const uniqueOperationCounts = new Set(faultsWithCode.map(fault => fault.operation_id)).size;
+ const uniqueOperationCounts = new Set(faultsWithCode.map(fault => fault.operationId)).size;
return {
code: code,
count: faultsWithCode.length,
- operation_count: uniqueOperationCounts,
+ operationCount: uniqueOperationCounts,
}
}).sort((a, b) => a.code - b.code);
}
@@ -175,9 +175,9 @@ export const getFileColor = (index: number, file: string) => {
return colorList[index % colorList.length];
}
-export const getLanguage = (file_name: string) => {
+export const getLanguage = (fileName: string) => {
- switch (file_name.split('.').pop()) {
+ switch (fileName.split('.').pop()) {
case 'java':
return 'java';
case 'js':
@@ -197,79 +197,79 @@ export interface ITransformedReport {
endpoint: string;
faults: {
code: number;
- test_cases: string[];
+ testCases: string[];
}[];
- http_status_codes: {
+ httpStatusCodes: {
code: number;
- test_cases: string[];
+ testCases: string[];
}[];
}
export const transformWebFuzzingReport = (original: WebFuzzingCommonsReport | null): Array
=> {
- if (!original || !original.problem_details || !original.problem_details.rest) {
+ if (!original || !original.problemDetails || !original.problemDetails.rest) {
return [];
}
const endpointMap = new Map();
- original.problem_details.rest?.endpoint_ids.forEach(endpoint => {
+ original.problemDetails.rest?.endpointIds.forEach(endpoint => {
endpointMap.set(endpoint, {
endpoint,
- http_status_codes: [],
+ httpStatusCodes: [],
faults: []
});
});
- original.faults.found_faults.forEach(fault => {
- if (!fault.operation_id) {
+ original.faults.foundFaults.forEach(fault => {
+ if (!fault.operationId) {
return;
}
- if (!endpointMap.has(fault.operation_id)) {
- console.log(`Endpoint ${fault.operation_id} not found in endpoint_ids`);
+ if (!endpointMap.has(fault.operationId)) {
+ console.log(`Endpoint ${fault.operationId} not found in endpointIds`);
}
- const endpointData = endpointMap.get(fault.operation_id);
+ const endpointData = endpointMap.get(fault.operationId);
if (!endpointData) {
return;
}
- fault.fault_categories.forEach(faultCat => {
+ fault.faultCategories.forEach(faultCat => {
let existingFault = endpointData.faults.find((f: { code: number; }) => f.code === faultCat.code);
if (!existingFault) {
- existingFault = {code: faultCat.code, test_cases: []};
+ existingFault = {code: faultCat.code, testCases: []};
endpointData.faults.push(existingFault);
}
- if (!existingFault.test_cases.includes(fault.test_case_id)) {
- existingFault.test_cases.push(fault.test_case_id);
+ if (!existingFault.testCases.includes(fault.testCaseId)) {
+ existingFault.testCases.push(fault.testCaseId);
}
});
});
- if (original.problem_details.rest == null) {
+ if (original.problemDetails.rest == null) {
return Array.from([]);
}
- original.problem_details.rest.covered_http_status.forEach(status => {
- if (!endpointMap.has(status.endpoint_id)) {
- console.log(`Endpoint ${status.endpoint_id} not found in endpoint_ids`);
+ original.problemDetails.rest.coveredHttpStatus.forEach(status => {
+ if (!endpointMap.has(status.endpointId)) {
+ console.log(`Endpoint ${status.endpointId} not found in endpointIds`);
}
- const endpointData = endpointMap.get(status.endpoint_id);
+ const endpointData = endpointMap.get(status.endpointId);
- status.http_status.forEach(code => {
+ status.httpStatus.forEach(code => {
if (!endpointData) {
return;
}
- let existingStatus = endpointData.http_status_codes.find((s: { code: number; }) => s.code === code);
+ let existingStatus = endpointData.httpStatusCodes.find((s: { code: number; }) => s.code === code);
if (!existingStatus) {
- existingStatus = {code, test_cases: []};
- endpointData.http_status_codes.push(existingStatus);
+ existingStatus = {code, testCases: []};
+ endpointData.httpStatusCodes.push(existingStatus);
}
- if (!existingStatus.test_cases.includes(status.test_case_id)) {
- existingStatus.test_cases.push(status.test_case_id);
+ if (!existingStatus.testCases.includes(status.testCaseId)) {
+ existingStatus.testCases.push(status.testCaseId);
}
});
});
diff --git a/web-report/src/pages/Endpoints.tsx b/web-report/src/pages/Endpoints.tsx
index c86c1ff..36081d1 100644
--- a/web-report/src/pages/Endpoints.tsx
+++ b/web-report/src/pages/Endpoints.tsx
@@ -26,7 +26,7 @@ export const Endpoints: React.FC = ({addTestTab}) => {
filteredEndpoints.map((item, index) => (
))
}
diff --git a/web-report/src/pages/Overview.tsx b/web-report/src/pages/Overview.tsx
index b0c3772..e05119c 100644
--- a/web-report/src/pages/Overview.tsx
+++ b/web-report/src/pages/Overview.tsx
@@ -6,15 +6,15 @@ import {Faults, RESTReport, TestCase} from "@/types/GeneratedTypes.tsx";
interface IOverviewType {
rest: RESTReport | undefined
- test_cases: Array,
- test_files: Array<{
- file_name: string,
- number_of_test_cases: number
+ testCases: Array,
+ testFiles: Array<{
+ fileName: string,
+ numberOfTestCases: number
}>,
faults: Faults
}
-export const Overview: React.FC = ({rest, test_cases, test_files, faults}) => {
+export const Overview: React.FC = ({rest, testCases, testFiles, faults}) => {
return (
{/* Left Panel */}
@@ -22,7 +22,7 @@ export const Overview: React.FC
= ({rest, test_cases, test_files,
{/* Right Panel */}
{/* Generated Tests */}
-
+
{/* Faults */}
diff --git a/web-report/src/pages/TestResults.tsx b/web-report/src/pages/TestResults.tsx
index e429080..613e771 100644
--- a/web-report/src/pages/TestResults.tsx
+++ b/web-report/src/pages/TestResults.tsx
@@ -7,35 +7,35 @@ import {useAppContext} from "@/AppProvider.tsx";
interface IProps {
- test_case_name: string;
+ testCaseName: string;
}
-export const TestResults: React.FC = ({test_case_name}) => {
+export const TestResults: React.FC = ({testCaseName}) => {
const {data, testFiles} = useAppContext();
- const test_cases = data?.test_cases || [];
- const found_faults = data?.faults.found_faults || [];
- const problem_details = data?.problem_details || {};
- if (!problem_details.rest) {
+ const testCases = data?.testCases || [];
+ const foundFaults = data?.faults.foundFaults || [];
+ const problemDetails = data?.problemDetails || {};
+ if (!problemDetails.rest) {
return We are only supporting REST results now. You need to provide rest results.
}
- const test_case = test_cases.find((test) => test.id === test_case_name);
- const related_faults = found_faults.filter(fault => fault.test_case_id === test_case_name);
- const related_http_status = problem_details.rest.covered_http_status.filter(status => status.test_case_id === test_case_name);
+ const testCase = testCases.find((test) => test.id === testCaseName);
+ const relatedFaults = foundFaults.filter(fault => fault.testCaseId === testCaseName);
+ const relatedHttpStatus = problemDetails.rest.coveredHttpStatus.filter(status => status.testCaseId === testCaseName);
- const all_fault_codes = related_faults.map((fault) =>
- fault.fault_categories.map((f) => f.code)).flat();
- const unique_fault_codes = [...new Set(all_fault_codes)].sort((a, b) => a - b);
+ const allFaultCodes = relatedFaults.map((fault) =>
+ fault.faultCategories.map((f) => f.code)).flat();
+ const uniqueFaultCodes = [...new Set(allFaultCodes)].sort((a, b) => a - b);
- const all_status_codes = related_http_status.map((status) =>
- status.http_status.map((s) => s)).flat();
- const unique_status_codes = [...new Set(all_status_codes)].sort((a, b) => a - b);
- const current_file = testFiles.find((file) => file.name === test_case?.file_path);
+ const allStatusCodes = relatedHttpStatus.map((status) =>
+ status.httpStatus.map((s) => s)).flat();
+ const uniqueStatusCodes = [...new Set(allStatusCodes)].sort((a, b) => a - b);
+ const currentFile = testFiles.find((file) => file.name === testCase?.filePath);
- const extractedCode = current_file && test_case ? extractCodeLines(current_file.code, test_case?.start_line, test_case?.end_line) : "";
+ const extractedCode = currentFile && testCase ? extractCodeLines(currentFile.code, testCase?.startLine, testCase?.endLine) : "";
return (
@@ -45,14 +45,14 @@ export const TestResults: React.FC
= ({test_case_name}) => {
Related Codes
{
- unique_status_codes.length > 0 &&
+ uniqueStatusCodes.length > 0 &&
HTTPS
{
- unique_status_codes.map((code, i) => (
+ uniqueStatusCodes.map((code, i) => (
@@ -63,13 +63,13 @@ export const TestResults: React.FC = ({test_case_name}) => {
}
{
- unique_fault_codes.length > 0 &&
+ uniqueFaultCodes.length > 0 &&
FAULTS
{
- unique_fault_codes.map((code, index) => (
+ uniqueFaultCodes.map((code, index) => (
@@ -86,12 +86,12 @@ export const TestResults: React.FC = ({test_case_name}) => {
- {test_case?.id}
+ {testCase?.id}
{
- test_case && current_file && (
+ testCase && currentFile && (
-
+
)
}
diff --git a/web-report/src/types/GeneratedTypes.tsx b/web-report/src/types/GeneratedTypes.tsx
index c82155c..bf15d2f 100644
--- a/web-report/src/types/GeneratedTypes.tsx
+++ b/web-report/src/types/GeneratedTypes.tsx
@@ -26,36 +26,36 @@ export interface WebFuzzingCommonsReport {
/**
* The schema version of WFC needed to use to validate and process this document.
*/
- schema_version: string;
+ schemaVersion: string;
/**
* The name of the tool used to create the test cases reported in this document.
*/
- tool_name: string;
+ toolName: string;
/**
* The version number of the used tool, e.g., 1.0.0.
*/
- tool_version: string;
+ toolVersion: string;
/**
* The timestamp of when this report file was created.
*/
- creation_time: string;
+ creationTime: string;
faults: Faults;
- problem_details: {
+ problemDetails: {
rest?: RESTReport;
[k: string]: unknown;
};
/**
* The total number of test cases generated by the tool.
*/
- total_tests: number;
+ totalTests: number;
/**
* The list of relative paths (compared to this document) of all the generated test suite files.
*/
- test_file_paths: TestFilePath[];
+ testFilePaths: TestFilePath[];
/**
* Information on each generated test case.
*/
- test_cases: TestCase[];
+ testCases: TestCase[];
/**
* Extra, optional coverage information, collected by different tools.
*/
@@ -66,23 +66,23 @@ export interface Faults {
/**
* The total number of potential faults identified in the generated test suites. Each fault is uniquely identified with its 'code' category and 'context'. Note that different tests can detect the same fault, and a test case can detect several different faults.
*/
- total_number: number;
+ totalNumber: number;
/**
* Information on all the identified potential faults.
*/
- found_faults: FoundFault[];
+ foundFaults: FoundFault[];
[k: string]: unknown;
}
/**
* Data-structure to represent found faults, based on operations (e.g., HTTP endpoints in REST, and methods in GraphQL and RPC) and which tests find faults in them.
*/
export interface FoundFault {
- operation_id?: OperationId;
- test_case_id: TestCaseId;
+ operationId?: OperationId;
+ testCaseId: TestCaseId;
/**
* @minItems 1
*/
- fault_categories: [FaultCategoryId, ...FaultCategoryId[]];
+ faultCategories: [FaultCategoryId, ...FaultCategoryId[]];
[k: string]: unknown;
}
/**
@@ -103,34 +103,34 @@ export interface RESTReport {
/**
* 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.
*/
- total_http_calls: number;
+ totalHttpCalls: number;
/**
* Unique ids of all the endpoints in the tested API.
*/
- endpoint_ids: OperationId[];
+ endpointIds: OperationId[];
/**
* List of which HTTP status codes were covered, based on endpoints.
*/
- covered_http_status: CoveredEndpoint[];
+ coveredHttpStatus: CoveredEndpoint[];
[k: string]: unknown;
}
/**
* Data-structure to represent which HTTP status code where covered on an endpoint by any of the generated tests.
*/
export interface CoveredEndpoint {
- endpoint_id: OperationId;
- test_case_id: TestCaseId;
+ endpointId: OperationId;
+ testCaseId: TestCaseId;
/**
* As in a test case the same endpoint could be called more than once, here we report all of the obtained HTTP status codes
*
* @minItems 1
*/
- http_status: [HttpStatus, ...HttpStatus[]];
+ httpStatus: [HttpStatus, ...HttpStatus[]];
[k: string]: unknown;
}
export interface TestCase {
id?: TestCaseId;
- file_path?: TestFilePath;
+ filePath?: TestFilePath;
/**
* The name of the test case, as it appears in the generated test file.
*/
@@ -138,18 +138,18 @@ export interface TestCase {
/**
* The line number in the generated test suite file where the code of this test case starts.
*/
- start_line?: number;
+ startLine?: number;
/**
* The line number in the generated test suite file where the code of this test case ends.
*/
- end_line?: number;
+ endLine?: number;
[k: string]: unknown;
}
export interface Coverage {
/**
* The name of the tool used to collect and compute the coverage criteria.
*/
- tool_name: string;
+ toolName: string;
criteria: CoverageCriterion[];
[k: string]: unknown;
}