Skip to content

Commit

Permalink
Merge pull request #57 from webdriverio-community/elapsed-time
Browse files Browse the repository at this point in the history
add elapsed time to test results
  • Loading branch information
therealbrad authored Feb 1, 2023
2 parents a2c66ca + 08be9ba commit 7b3cb69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ export default class TestRailReporter extends WDIOReporter {
return this.#synced
}

onTestPass (test: TestStats) {
onTestPass(test: TestStats) {
this.#testCases.push({
case_id: test.title.split(' ')[0].replace('C', ''),
status_id: '1',
comment: 'This test case is passed'
comment: 'This test case is passed',
elapsed: test._duration / 1000 + 's'
})
}

onTestFail (test: TestStats) {
this.#testCases.push({
case_id: test.title.split(' ')[0].replace('C', ''),
status_id: '5',
comment: `This test case is failed:\n ${JSON.stringify(test.errors)}`
comment: `This test case is failed:\n ${JSON.stringify(test.errors)}`,
elapsed: test._duration / 1000 + 's'
})
}

Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface TestCase {
case_id: string
status_id: string
comment: string
elapsed?: string
}

export interface ReporterOptions {
Expand Down

0 comments on commit 7b3cb69

Please sign in to comment.