@testomatio/reporter 0.6.9 → 0.7.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +9 -0
- package/README.md +16 -7
- package/lib/adapter/codecept.js +1 -1
- package/lib/adapter/cucumber/current.js +185 -0
- package/lib/adapter/cucumber/legacy.js +136 -0
- package/lib/adapter/cucumber.js +15 -135
- package/lib/adapter/cypress-plugin/index.js +4 -1
- package/lib/adapter/mocha.js +1 -0
- package/lib/adapter/webdriver.js +1 -0
- package/lib/fileUploader.js +2 -1
- package/lib/junit-adapter/csharp.js +18 -0
- package/lib/xmlReader.js +71 -3
- package/package.json +12 -9
- package/testcafe/package-lock.json +863 -0
- package/testcafe/package.json +1 -1
- package/.eslintrc.js +0 -35
- package/.github/workflows/node.js.yml +0 -30
- package/.prettierrc.js +0 -12
- package/example/codecept/codecept.conf.js +0 -29
- package/example/codecept/index_test.js +0 -10
- package/example/codecept/jsconfig.json +0 -5
- package/example/codecept/sample_test.js +0 -6
- package/example/codecept/steps.d.ts +0 -16
- package/example/codecept/steps_file.js +0 -10
- package/example/core/index.js +0 -15
- package/example/jest/index.test.js +0 -9
- package/example/jest/jest.config.js +0 -188
- package/example/jest/package.json +0 -13
- package/example/jest/sample.test.js +0 -13
- package/example/jest/yarn.lock +0 -8
- package/example/mocha/test/index.test.js +0 -13
- package/tests/adapter/config/index.js +0 -10
- package/tests/adapter/examples/codecept/codecept.conf.js +0 -33
- package/tests/adapter/examples/codecept/index_test.js +0 -11
- package/tests/adapter/examples/codecept/jsconfig.json +0 -5
- package/tests/adapter/examples/codecept/output/Test_for_suite_2_@Tc2171bd2.failed.png +0 -0
- package/tests/adapter/examples/codecept/output/Test_issue_for_suite_1_@Tca70c8c4.failed.png +0 -0
- package/tests/adapter/examples/codecept/sample_test.js +0 -7
- package/tests/adapter/examples/codecept/steps_file.js +0 -10
- package/tests/adapter/examples/jasmine/index.test.js +0 -11
- package/tests/adapter/examples/jasmine/passReporterOpts.sh +0 -8
- package/tests/adapter/examples/jest/index.test.js +0 -11
- package/tests/adapter/examples/jest/jest.config.js +0 -4
- package/tests/adapter/examples/mocha/index.test.js +0 -13
- package/tests/adapter/examples/mocha/mocha.config.js +0 -4
- package/tests/adapter/index.test.js +0 -136
- package/tests/adapter/utils/index.js +0 -40
- package/tests/data/artifacts/failed_test.png +0 -0
- package/tests/data/artifacts/screenshot1.png +0 -0
- package/tests/data/cli/RunCest.php +0 -1024
- package/tests/data/cli/SnapshotCest.php +0 -97
- package/tests/data/codecept.xml +0 -150
- package/tests/data/codecept2.xml +0 -25
- package/tests/data/java.xml +0 -25
- package/tests/data/junit1.xml +0 -70
- package/tests/data/minitest.xml +0 -25
- package/tests/data/phpunit.xml +0 -65
- package/tests/data/pytest.xml +0 -13
- package/tests/data/src/services/search_service_test.rb +0 -146
- package/tests/util_test.js +0 -51
- package/tests/xmlReader_test.js +0 -232
package/lib/xmlReader.js
CHANGED
|
@@ -5,15 +5,15 @@ const fs = require("fs");
|
|
|
5
5
|
|
|
6
6
|
// const util = require("util"); // you can see a result
|
|
7
7
|
const { XMLParser } = require("fast-xml-parser");
|
|
8
|
-
const { APP_PREFIX } = require('./constants');
|
|
8
|
+
const { APP_PREFIX, PASSED, FAILED, SKIPPED } = require('./constants');
|
|
9
9
|
const { isValidUrl, fetchFilesFromStackTrace, fetchSourceCode, fetchSourceCodeFromStackTrace } = require('./util');
|
|
10
10
|
const upload = require('./fileUploader');
|
|
11
|
-
|
|
12
11
|
const Adapter = require('./junit-adapter/adapter');
|
|
13
12
|
const JavaScriptAdapter = require('./junit-adapter/javascript');
|
|
14
13
|
const JavaAdapter = require('./junit-adapter/java');
|
|
15
14
|
const PythonAdapter = require('./junit-adapter/python');
|
|
16
15
|
const RubyAdapter = require('./junit-adapter/ruby');
|
|
16
|
+
const CSharpAdapter = require('./junit-adapter/csharp');
|
|
17
17
|
|
|
18
18
|
const TESTOMATIO_URL = process.env.TESTOMATIO_URL || "https://app.testomat.io";
|
|
19
19
|
const TESTOMATIO = process.env.TESTOMATIO; // key?
|
|
@@ -63,21 +63,32 @@ class XmlReader {
|
|
|
63
63
|
if (this.stats.language === 'ruby') {
|
|
64
64
|
this.adapter = new RubyAdapter(this.opts);
|
|
65
65
|
}
|
|
66
|
+
if (this.stats.language === 'c#' || this.stats.language === 'csharp') {
|
|
67
|
+
this.adapter = new CSharpAdapter(this.opts);
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
parse(fileName) {
|
|
69
72
|
const xmlData = fs.readFileSync(path.resolve(fileName));
|
|
70
73
|
const jsonResult = this.parser.parse(xmlData);
|
|
71
74
|
let jsonSuite;
|
|
72
|
-
|
|
75
|
+
|
|
73
76
|
if (jsonResult.testsuites) {
|
|
74
77
|
jsonSuite = jsonResult.testsuites;
|
|
75
78
|
} else if (jsonResult.testsuite) {
|
|
76
79
|
jsonSuite = jsonResult;
|
|
80
|
+
} else if (jsonResult.TestRun) {
|
|
81
|
+
|
|
82
|
+
return this.processNUnit(jsonResult);
|
|
77
83
|
} else {
|
|
78
84
|
console.log(jsonResult)
|
|
79
85
|
throw new Error("Format can't be parsed")
|
|
80
86
|
}
|
|
87
|
+
|
|
88
|
+
return this.processJUnit(jsonSuite);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
processJUnit(jsonSuite) {
|
|
81
92
|
const { testsuite, name, tests, failures, errors } = jsonSuite;
|
|
82
93
|
|
|
83
94
|
reduceOptions.preferClassname = this.stats.language === 'python';
|
|
@@ -100,6 +111,62 @@ class XmlReader {
|
|
|
100
111
|
};
|
|
101
112
|
}
|
|
102
113
|
|
|
114
|
+
processNUnit(jsonSuite) {
|
|
115
|
+
const tests = jsonSuite?.TestRun?.TestDefinitions?.UnitTest?.map(td => {
|
|
116
|
+
const title = td.name.replace(/\(.*?\)/, '').trim();
|
|
117
|
+
let example = td.name.match(/\((.*?)\)/);
|
|
118
|
+
if (example) example = { ...example[1].split(',')};
|
|
119
|
+
const suite = td.TestMethod.className.split('.');
|
|
120
|
+
const suite_title = suite.pop();
|
|
121
|
+
return {
|
|
122
|
+
title,
|
|
123
|
+
example,
|
|
124
|
+
file: suite.join('/'),
|
|
125
|
+
suite_title,
|
|
126
|
+
id: td.Execution.id,
|
|
127
|
+
}
|
|
128
|
+
}) || [];
|
|
129
|
+
|
|
130
|
+
const results = jsonSuite?.TestRun?.Results?.UnitTestResult?.map(td => ({
|
|
131
|
+
id: td.executionId,
|
|
132
|
+
run_time: td.duration,
|
|
133
|
+
status: td.outcome,
|
|
134
|
+
stack: td.Output.StdOut
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
results.forEach(r => {
|
|
138
|
+
const test = tests.find(t => t.id === r.id) || {};
|
|
139
|
+
r.suite_title = test.suite_title;
|
|
140
|
+
r.title = test.title?.trim();
|
|
141
|
+
if (test.example) r.example = test.example;
|
|
142
|
+
if (test.file) r.file = test.file;
|
|
143
|
+
r.create = true;
|
|
144
|
+
if (r.status === 'Passed') r.status = PASSED;
|
|
145
|
+
if (r.status === 'Failed') r.status = FAILED;
|
|
146
|
+
if (r.status === 'Skipped') r.status = SKIPPED;
|
|
147
|
+
delete r.id;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const counters = jsonSuite?.TestRun?.ResultSummary?.Counters || {};
|
|
151
|
+
|
|
152
|
+
const failed_count = parseInt(counters.failed, 10) + parseInt(counters.error, 10);
|
|
153
|
+
|
|
154
|
+
let status = PASSED;
|
|
155
|
+
if (failed_count > 0) status = FAILED;
|
|
156
|
+
|
|
157
|
+
this.tests = results;
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
status,
|
|
161
|
+
create_tests: true,
|
|
162
|
+
tests_count: parseInt(counters.total, 10),
|
|
163
|
+
passed_count: parseInt(counters.passed, 10),
|
|
164
|
+
skipped_count: parseInt(counters.notExecuted, 10),
|
|
165
|
+
failed_count,
|
|
166
|
+
tests: results,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
103
170
|
calculateStats() {
|
|
104
171
|
this.stats = {
|
|
105
172
|
...this.stats,
|
|
@@ -164,6 +231,7 @@ class XmlReader {
|
|
|
164
231
|
// remove standard prefixes
|
|
165
232
|
.replace(/^test\s/, '')
|
|
166
233
|
.replace(/^should\s/, '')
|
|
234
|
+
.trim();
|
|
167
235
|
});
|
|
168
236
|
}
|
|
169
237
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"main": "./lib/reporter.js",
|
|
6
6
|
"repository": "git@github.com:testomatio/reporter.git",
|
|
7
|
-
"author": "Koushik Mohan <koushikmohan1996@gmail.com>",
|
|
7
|
+
"author": "Michael Bodnarchuk <davert@testomat.io>,Koushik Mohan <koushikmohan1996@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"aws-sdk": "^2.1072.0",
|
|
@@ -20,25 +20,28 @@
|
|
|
20
20
|
"json-cycle": "^1.3.0",
|
|
21
21
|
"lodash.memoize": "^4.1.2"
|
|
22
22
|
},
|
|
23
|
+
"files": [
|
|
24
|
+
"bin",
|
|
25
|
+
"lib",
|
|
26
|
+
"testcafe"
|
|
27
|
+
],
|
|
23
28
|
"scripts": {
|
|
24
29
|
"pretty": "prettier --write .",
|
|
25
30
|
"lint": "eslint lib",
|
|
26
31
|
"lint:fix": "eslint lib --fix",
|
|
27
32
|
"test": "mocha tests/**",
|
|
33
|
+
"init": "cd ./tests/adapter/examples/cucumber && npm i",
|
|
28
34
|
"test:unit": "mocha tests",
|
|
29
35
|
"test:adapter": "mocha './tests/adapter/index.test.js'",
|
|
30
36
|
"test:adapter:jest:example": "jest './tests/adapter/examples/jest/index.test.js' --config='./tests/adapter/examples/jest/jest.config.js'",
|
|
31
37
|
"test:adapter:mocha:example": "mocha './tests/adapter/examples/mocha/index.test.js' --config='./tests/adapter/examples/mocha/mocha.config.js'",
|
|
32
38
|
"test:adapter:jasmine:example": "./tests/adapter/examples/jasmine/passReporterOpts.sh && jasmine './tests/adapter/examples/jasmine/index.test.js' --reporter=./../../../lib/adapter/jasmine.js",
|
|
33
|
-
"test:adapter:codecept:example": "codeceptjs run --config='./tests/adapter/examples/codecept/codecept.conf.js'"
|
|
34
|
-
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"@wdio/reporter": "*",
|
|
37
|
-
"codeceptjs": "*",
|
|
38
|
-
"cucumber": "*",
|
|
39
|
-
"mocha": "*"
|
|
39
|
+
"test:adapter:codecept:example": "codeceptjs run --config='./tests/adapter/examples/codecept/codecept.conf.js'",
|
|
40
|
+
"test:adapter:cucumber:example": "cd ./tests/adapter/examples/cucumber && npx cucumber-js"
|
|
40
41
|
},
|
|
42
|
+
"peerDependencies": {},
|
|
41
43
|
"devDependencies": {
|
|
44
|
+
"@cucumber/cucumber": "^8.6.0",
|
|
42
45
|
"@wdio/reporter": "^7.16.13",
|
|
43
46
|
"chai": "^4.3.6",
|
|
44
47
|
"codeceptjs": "^3.2.3",
|