-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ab81fe
commit c071b6a
Showing
6 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,17 @@ | |
"xUnit", | ||
"TestNG", | ||
"parser", | ||
"parse", | ||
"test", | ||
"testing", | ||
"results", | ||
"result", | ||
"report", | ||
"automation", | ||
"mocha", | ||
"cucumber", | ||
"nUnit", | ||
"MSTest", | ||
"testbeats" | ||
], | ||
"author": "Anudeep <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,69 @@ | ||
import TestResult from "./models/TestResult"; | ||
|
||
declare interface ParseOptions { | ||
export interface ITestResult { | ||
name: string; | ||
total: number; | ||
passed: number; | ||
failed: number; | ||
errors: number; | ||
skipped: number; | ||
retried: number; | ||
duration: number; | ||
status: string; | ||
tags: string[]; | ||
metadata: object; | ||
suites: ITestSuite[]; | ||
} | ||
|
||
export interface ITestSuite { | ||
name: string; | ||
total: number; | ||
passed: number; | ||
failed: number; | ||
errors: number; | ||
skipped: number; | ||
duration: number; | ||
status: string; | ||
tags: string[]; | ||
metadata: object; | ||
cases: ITestCase[]; | ||
} | ||
|
||
export interface ITestCase { | ||
name: string; | ||
total: number; | ||
passed: number; | ||
failed: number; | ||
errors: number; | ||
skipped: number; | ||
duration: number; | ||
status: string; | ||
failure: string; | ||
stack_trace: string; | ||
tags: string[]; | ||
metadata: object; | ||
steps: ITestStep[]; | ||
attachments: ITestAttachment[]; | ||
} | ||
|
||
export interface ITestStep { | ||
name: string; | ||
duration: number; | ||
status: string; | ||
failure: string; | ||
stack_trace: string; | ||
} | ||
|
||
export interface ITestAttachment { | ||
name: string; | ||
path: string; | ||
} | ||
|
||
export interface ParseOptions { | ||
type: string; | ||
files: string[]; | ||
} | ||
|
||
export function parse(options: ParseOptions): TestResult; | ||
export function parse(options: ParseOptions): ITestResult; | ||
export function parseV2(options: ParseOptions): { result: ITestResult, errors: string[] }; | ||
|
||
export namespace parser { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { parseV2 } = require('../src'); | ||
const assert = require('assert'); | ||
|
||
describe('Parser V2 - JUnit', () => { | ||
|
||
const testDataPath = "tests/data/junit" | ||
|
||
it('with all files valid', () => { | ||
const { result } = parseV2({ type: 'junit', ignore_error_count: true, files: [`${testDataPath}/playwright-failures.xml`]}); | ||
assert.equal(result.total, 16); | ||
assert.equal(result.passed, 14); | ||
assert.equal(result.failed, 2); | ||
assert.equal(result.status, 'FAIL'); | ||
assert.equal(result.suites[1].cases[1].attachments[0].name, `test-failed-1.png`); | ||
assert.equal(result.suites[1].cases[1].attachments[0].path, `example-get-started-link-chromium/test-failed-1.png`); | ||
}); | ||
|
||
it('with one invalid file ', () => { | ||
const { result, errors } = parseV2({ type: 'junit', ignore_error_count: true, files: [`${testDataPath}/playwright-failures.xml`, `${testDataPath}/playwright-failures.json`] }); | ||
assert.equal(result.total, 16); | ||
assert.equal(result.passed, 14); | ||
assert.equal(result.failed, 2); | ||
assert.equal(result.status, 'FAIL'); | ||
assert.equal(result.suites[1].cases[1].attachments[0].name, `test-failed-1.png`); | ||
assert.equal(result.suites[1].cases[1].attachments[0].path, `example-get-started-link-chromium/test-failed-1.png`); | ||
assert.ok(errors.length === 1); | ||
assert.ok(errors[0].includes(`Error`)); | ||
}); | ||
|
||
it('with all files invalid', () => { | ||
const { result, errors } = parseV2({ type: 'junit', ignore_error_count: true, files: [`${testDataPath}/invalid.xml`, `${testDataPath}/invalid.json`] }); | ||
assert.equal(result, null); | ||
assert.ok(errors.length === 2); | ||
assert.ok(errors[0].includes(`Error`)); | ||
assert.ok(errors[1].includes(`Error`)); | ||
}); | ||
|
||
}); |