MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / makeResult

Function makeResult

test/unit/junitReporter_test.js:32–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32function makeResult() {
33 const loginSuite = { title: 'Login', file: '/tests/login_test.js', startedAt: Date.now() }
34 const dashSuite = { title: 'Dashboard', file: '/tests/dashboard_test.js', startedAt: Date.now() }
35
36 const login = metaStep('user', 'login', ['joe'], 'success')
37 const passed = {
38 title: 'logs in successfully',
39 state: 'passed',
40 duration: 1234,
41 uid: 'pass-1',
42 parent: loginSuite,
43 file: loginSuite.file,
44 tags: ['@important', '@smoke'],
45 meta: { severity: 'critical', owner: 'qa-team' },
46 steps: [step('amOnPage', ['/login'], 'success'), step('fillField', ['login', 'joe'], 'success'), step('click', ['Sign in'], 'success'), step('see', ['Welcome'], 'success')],
47 }
48 passed.steps[1].setMetaStep(login)
49 passed.steps[2].setMetaStep(login)
50
51 const failLogin = metaStep('user', 'login', ['bad'], 'failed')
52 const failed = {
53 title: 'fails to log in',
54 state: 'failed',
55 duration: 567,
56 uid: 'fail-1',
57 parent: loginSuite,
58 file: loginSuite.file,
59 meta: {},
60 err: new Error('expected dashboard to be visible'),
61 steps: [step('amOnPage', ['/login'], 'success'), step('fillField', ['login', 'bad'], 'failed')],
62 }
63 failed.steps[1].setMetaStep(failLogin)
64
65 const skipped = {
66 title: 'shows widgets',
67 state: 'skipped',
68 uid: 'skip-1',
69 parent: dashSuite,
70 file: dashSuite.file,
71 meta: {},
72 steps: [],
73 }
74
75 return {
76 tests: [passed, failed, skipped],
77 stats: { start: new Date(), passes: 1, failures: 1, pending: 1, tests: 3 },
78 duration: 4321,
79 }
80}
81
82function parseReport(dir) {
83 return new xml2js.Parser().parseStringPromise(fs.readFileSync(path.join(dir, 'report.xml'), 'utf8'))

Callers 1

Calls 3

metaStepFunction · 0.85
setMetaStepMethod · 0.80
stepFunction · 0.70

Tested by

no test coverage detected