testit-adapter-cucumber 1.0.2 → 1.0.3
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/.vs/VSWorkspaceState.json +8 -0
- package/.vs/slnx.sqlite +0 -0
- package/.vs/testit-adapter-cucumber/v16/.suo +0 -0
- package/.vs/testit-adapter-cucumber/v16/TestStore/0/000.testlog +0 -0
- package/.vs/testit-adapter-cucumber/v16/TestStore/0/testlog.manifest +0 -0
- package/dist/formatter.d.ts +1 -0
- package/dist/formatter.js +47 -28
- package/dist/formatter.js.map +1 -1
- package/dist/storage.js +47 -48
- package/dist/storage.js.map +1 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +11 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/formatter.ts +58 -39
- package/src/storage.ts +53 -54
- package/src/utils.ts +14 -1
- package/readme.md +0 -87
package/.vs/slnx.sqlite
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/formatter.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class TestItFormatter extends Formatter implements IFormatter {
|
|
|
8
8
|
client: IClient;
|
|
9
9
|
storage: IStorage;
|
|
10
10
|
currentTestCaseId: string | undefined;
|
|
11
|
+
resolvedAutotests: Array<string | undefined> | undefined;
|
|
11
12
|
constructor(options: IFormatterOptions, config: Partial<ClientConfigWithFile>);
|
|
12
13
|
private testRunId;
|
|
13
14
|
private testRunStarted;
|
package/dist/formatter.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.TestItFormatter = void 0;
|
|
|
4
4
|
const cucumber_1 = require("@cucumber/cucumber");
|
|
5
5
|
const testit_api_client_1 = require("testit-api-client");
|
|
6
6
|
const storage_1 = require("./storage");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
7
8
|
class TestItFormatter extends cucumber_1.Formatter {
|
|
8
9
|
constructor(options, config) {
|
|
9
10
|
super(options);
|
|
@@ -18,7 +19,20 @@ class TestItFormatter extends cucumber_1.Formatter {
|
|
|
18
19
|
return this.onGherkinDocument(envelope.gherkinDocument);
|
|
19
20
|
}
|
|
20
21
|
if (envelope.pickle) {
|
|
21
|
-
|
|
22
|
+
if (this.resolvedAutotests !== undefined) {
|
|
23
|
+
if (this.resolvedAutotests.length > 0) {
|
|
24
|
+
const tags = (0, utils_1.parseTags)(envelope.pickle.tags);
|
|
25
|
+
for (const externalId of this.resolvedAutotests) {
|
|
26
|
+
if (externalId === tags.externalId) {
|
|
27
|
+
return this.onPickle(envelope.pickle);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
envelope.pickle = undefined;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return this.onPickle(envelope.pickle);
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
if (envelope.testCase) {
|
|
24
38
|
return this.onTestCase(envelope.testCase);
|
|
@@ -50,7 +64,7 @@ class TestItFormatter extends cucumber_1.Formatter {
|
|
|
50
64
|
this.addAttachments.bind(this);
|
|
51
65
|
}
|
|
52
66
|
onMeta(_meta) {
|
|
53
|
-
const { projectId, testRunId } = this.client.getConfig();
|
|
67
|
+
const { projectId, testRunId, configurationId } = this.client.getConfig();
|
|
54
68
|
if (testRunId === undefined) {
|
|
55
69
|
this.testRunId = this.client
|
|
56
70
|
.createTestRun({
|
|
@@ -60,6 +74,8 @@ class TestItFormatter extends cucumber_1.Formatter {
|
|
|
60
74
|
}
|
|
61
75
|
else {
|
|
62
76
|
this.testRunId = Promise.resolve(testRunId);
|
|
77
|
+
const responce = this.client.getTestRun(testRunId);
|
|
78
|
+
this.resolvedAutotests = (0, utils_1.parsedAutotests)(responce.testResults, configurationId);
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
81
|
onGherkinDocument(document) {
|
|
@@ -98,32 +114,35 @@ class TestItFormatter extends cucumber_1.Formatter {
|
|
|
98
114
|
if (this.testRunStarted === undefined) {
|
|
99
115
|
throw new Error('Test run is not started yet');
|
|
100
116
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Promise.all(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
const { configurationId } = this.client.getConfig();
|
|
118
|
+
const results = this.storage.getTestRunResults(configurationId);
|
|
119
|
+
if (results.length > 0) {
|
|
120
|
+
Promise.all([
|
|
121
|
+
this.testRunId,
|
|
122
|
+
this.testRunStarted,
|
|
123
|
+
Promise.all(this.attachmentsQueue),
|
|
124
|
+
])
|
|
125
|
+
.then(async ([id]) => {
|
|
126
|
+
const autotests = this.storage.getAutotests(this.client.getConfig().projectId);
|
|
127
|
+
await Promise.all(autotests.map((autotestPost) => {
|
|
128
|
+
const result = results.find((result) => result.autotestExternalId === autotestPost.externalId);
|
|
129
|
+
if (result !== undefined) {
|
|
130
|
+
if (result.outcome !== 'Passed') {
|
|
131
|
+
return this.loadAutotest(autotestPost);
|
|
132
|
+
}
|
|
133
|
+
return this.loadPassedAutotest(autotestPost);
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
await Promise.all(results.map((result) => {
|
|
137
|
+
return this.client.loadTestRunResults(id, [result]);
|
|
138
|
+
}));
|
|
139
|
+
})
|
|
140
|
+
.catch((err) => {
|
|
141
|
+
var _a;
|
|
142
|
+
console.error(err);
|
|
143
|
+
(_a = this.testRunId) === null || _a === void 0 ? void 0 : _a.then((id) => this.client.completeTestRun(id));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
127
146
|
}
|
|
128
147
|
async loadAutotest(autotestPost) {
|
|
129
148
|
var _a;
|
package/dist/formatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":";;;AAAA,iDAAkE;AAclE,yDAK2B;AAE3B,uCAAoC;
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":";;;AAAA,iDAAkE;AAclE,yDAK2B;AAE3B,uCAAoC;AAIpC,mCAAqD;AAErD,MAAa,eAAgB,SAAQ,oBAAS;IAM5C,YACE,OAA0B,EAC1B,MAAqC;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QARjB,YAAO,GAAa,IAAI,iBAAO,EAAE,CAAC;QAgE1B,qBAAgB,GAAoB,EAAE,CAAC;QAvD7C,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAM,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAkB,EAAE,EAAE;YAC7D,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACjB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aACnC;YACD,IAAI,QAAQ,CAAC,eAAe,EAAE;gBAC5B,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;aACzD;YACD,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;oBACxC,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;wBACrC,MAAM,IAAI,GAAG,IAAA,iBAAS,EAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAC7C,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,iBAAiB,EAAE;4BAC/C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;gCAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,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AAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CACxB,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YACtC,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YAC5D,IAAI,EAAE,KAAK,SAAS,EAAE;gBACpB,aAAa;gBACb,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;gBAC9C,OAAO;aACR;YACD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,QAAQ,CAAC,GAAe;;QAC9B,OAAO,CAAC,KAAK,CACX,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,EACpB,GAAG,CAAC,MAAM,CAAC,MAAM,EACjB,GAAG,CAAC,MAAM,CAAC,GAAG,EACd,MAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,CACnB,CAAC;IACJ,CAAC;CAGF;AApRD,0CAoRC"}
|
package/dist/storage.js
CHANGED
|
@@ -44,58 +44,57 @@ class Storage {
|
|
|
44
44
|
var _a, _b, _c;
|
|
45
45
|
const results = [];
|
|
46
46
|
for (const pickle of this.pickles) {
|
|
47
|
-
const tags = (0, utils_1.parseTags)(pickle.tags);
|
|
48
|
-
if (tags.externalId === undefined) {
|
|
49
|
-
throw new Error('External id is not provided');
|
|
50
|
-
}
|
|
51
47
|
const testCase = this.testCases.find((testCase) => testCase.pickleId === pickle.id);
|
|
52
|
-
if (testCase
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.map((step) => this.getStepResult(step, testCase))
|
|
65
|
-
.filter((item, i, arr) => {
|
|
66
|
-
var _a;
|
|
67
|
-
const prevOutcome = (_a = arr[i - 1]) === null || _a === void 0 ? void 0 : _a.outcome;
|
|
68
|
-
if (item.outcome === 'Skipped' &&
|
|
69
|
-
prevOutcome !== undefined &&
|
|
70
|
-
['Failed', 'Skipped'].includes(prevOutcome)) {
|
|
71
|
-
return false;
|
|
48
|
+
if (testCase !== undefined) {
|
|
49
|
+
const tags = (0, utils_1.parseTags)(pickle.tags);
|
|
50
|
+
if (tags.externalId === undefined) {
|
|
51
|
+
throw new Error('External id is not provided');
|
|
52
|
+
}
|
|
53
|
+
const testCaseStarted = this.testCasesStarted.find((testCase) => testCase.id === testCase.id);
|
|
54
|
+
if (testCaseStarted === undefined) {
|
|
55
|
+
throw new Error('TestCaseStarted not found');
|
|
56
|
+
}
|
|
57
|
+
const testCaseFinished = this.testCasesFinished.find((testCase) => testCase.testCaseStartedId === testCaseStarted.id);
|
|
58
|
+
if (testCaseFinished === undefined) {
|
|
59
|
+
throw new Error('TestCaseFinished not found');
|
|
72
60
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
const steps = pickle.steps
|
|
62
|
+
.map((step) => this.getStepResult(step, testCase))
|
|
63
|
+
.filter((item, i, arr) => {
|
|
64
|
+
var _a;
|
|
65
|
+
const prevOutcome = (_a = arr[i - 1]) === null || _a === void 0 ? void 0 : _a.outcome;
|
|
66
|
+
if (item.outcome === 'Skipped' &&
|
|
67
|
+
prevOutcome !== undefined &&
|
|
68
|
+
['Failed', 'Skipped'].includes(prevOutcome)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
const messages = [];
|
|
74
|
+
for (const step of pickle.steps) {
|
|
75
|
+
const message = this.getStepMessage(step, testCase);
|
|
76
|
+
if (message !== undefined) {
|
|
77
|
+
messages.push(message);
|
|
78
|
+
}
|
|
80
79
|
}
|
|
80
|
+
const links = (_a = this.links[testCase.id]) !== null && _a !== void 0 ? _a : [];
|
|
81
|
+
links.push(...tags.links);
|
|
82
|
+
const result = {
|
|
83
|
+
autotestExternalId: tags.externalId,
|
|
84
|
+
configurationId,
|
|
85
|
+
links,
|
|
86
|
+
stepResults: steps,
|
|
87
|
+
outcome: (0, utils_1.calculateResultOutcome)(steps.map((step) => step.outcome)),
|
|
88
|
+
startedOn: (0, mappers_1.mapDate)(testCaseStarted.timestamp.seconds),
|
|
89
|
+
completeOn: (0, mappers_1.mapDate)(testCaseFinished.timestamp.seconds),
|
|
90
|
+
duration: testCaseFinished.timestamp.seconds -
|
|
91
|
+
testCaseStarted.timestamp.seconds,
|
|
92
|
+
message: (_c = (_b = this.messages[testCase.id]) === null || _b === void 0 ? void 0 : _b.join('\n\n')) !== null && _c !== void 0 ? _c : undefined,
|
|
93
|
+
traces: messages.join('\n\n'),
|
|
94
|
+
attachments: this.getAttachments(testCase.id),
|
|
95
|
+
};
|
|
96
|
+
results.push(result);
|
|
81
97
|
}
|
|
82
|
-
const links = (_a = this.links[testCase.id]) !== null && _a !== void 0 ? _a : [];
|
|
83
|
-
links.push(...tags.links);
|
|
84
|
-
const result = {
|
|
85
|
-
autotestExternalId: tags.externalId,
|
|
86
|
-
configurationId,
|
|
87
|
-
links,
|
|
88
|
-
stepResults: steps,
|
|
89
|
-
outcome: (0, utils_1.calculateResultOutcome)(steps.map((step) => step.outcome)),
|
|
90
|
-
startedOn: (0, mappers_1.mapDate)(testCaseStarted.timestamp.seconds),
|
|
91
|
-
completeOn: (0, mappers_1.mapDate)(testCaseFinished.timestamp.seconds),
|
|
92
|
-
duration: testCaseFinished.timestamp.seconds -
|
|
93
|
-
testCaseStarted.timestamp.seconds,
|
|
94
|
-
message: (_c = (_b = this.messages[testCase.id]) === null || _b === void 0 ? void 0 : _b.join('\n\n')) !== null && _c !== void 0 ? _c : undefined,
|
|
95
|
-
traces: messages.join('\n\n'),
|
|
96
|
-
attachments: this.getAttachments(testCase.id),
|
|
97
|
-
};
|
|
98
|
-
results.push(result);
|
|
99
98
|
}
|
|
100
99
|
return results;
|
|
101
100
|
}
|
package/dist/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAiBA,uCAKmB;AACnB,mCAA4D;AAE5D,MAAa,OAAO;IAApB;QACU,qBAAgB,GAAsB,EAAE,CAAC;QACzC,YAAO,GAAa,EAAE,CAAC;QACvB,cAAS,GAAe,EAAE,CAAC;QAC3B,qBAAgB,GAAsB,EAAE,CAAC;QACzC,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,qBAAgB,GAAsB,EAAE,CAAC;QACzC,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,aAAQ,GAA6B,EAAE,CAAC;QACxC,UAAK,GAA+B,EAAE,CAAC;QACvC,gBAAW,GAA6B,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAiBA,uCAKmB;AACnB,mCAA4D;AAE5D,MAAa,OAAO;IAApB;QACU,qBAAgB,GAAsB,EAAE,CAAC;QACzC,YAAO,GAAa,EAAE,CAAC;QACvB,cAAS,GAAe,EAAE,CAAC;QAC3B,qBAAgB,GAAsB,EAAE,CAAC;QACzC,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,qBAAgB,GAAsB,EAAE,CAAC;QACzC,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,aAAQ,GAA6B,EAAE,CAAC;QACxC,UAAK,GAA+B,EAAE,CAAC;QACvC,gBAAW,GAA6B,EAAE,CAAC;IA+KrD,CAAC;IA7KC,mBAAmB,CAAC,QAAyB;QAC3C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,YAAY,CAAC,SAAiB;QAC5B,OAAO,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EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;SAChC;aAAM;YACL,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;SACvC;IACH,CAAC;IACD,aAAa,CAAC,UAAkB,EAAE,YAAoB;QACpD,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE;YAC9C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;SAC/C;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SACnD;IACH,CAAC;CACF;AAzLD,0BAyLC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tag } from '@cucumber/messages';
|
|
2
|
-
import { Link, OutcomeType } from 'testit-api-client';
|
|
2
|
+
import { Link, OutcomeType, TestResultGet } from 'testit-api-client';
|
|
3
3
|
import { ParsedTags, TagType } from './types/tags';
|
|
4
4
|
export declare function getTagType(tag: string): TagType;
|
|
5
5
|
export declare function getExternalId(tag: string): string;
|
|
@@ -12,3 +12,4 @@ export declare function getDescription(tag: string): string;
|
|
|
12
12
|
export declare function getLabel(tag: string): string;
|
|
13
13
|
export declare function parseTags(tags: readonly Pick<Tag, 'name'>[]): ParsedTags;
|
|
14
14
|
export declare function calculateResultOutcome(outcomes: (OutcomeType | undefined)[]): OutcomeType;
|
|
15
|
+
export declare function parsedAutotests(autotests: Array<TestResultGet>, configurationId: string): Array<string | undefined>;
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateResultOutcome = exports.parseTags = exports.getLabel = exports.getDescription = exports.getName = exports.getWorkItemId = exports.getTitle = exports.getLink = exports.getLinkUrl = exports.getExternalId = exports.getTagType = void 0;
|
|
3
|
+
exports.parsedAutotests = exports.calculateResultOutcome = exports.parseTags = exports.getLabel = exports.getDescription = exports.getName = exports.getWorkItemId = exports.getTitle = exports.getLink = exports.getLinkUrl = exports.getExternalId = exports.getTagType = void 0;
|
|
4
4
|
const tags_1 = require("./types/tags");
|
|
5
5
|
function getTagType(tag) {
|
|
6
6
|
if (new RegExp(`^@${tags_1.tags.externalId}=.+$`).test(tag)) {
|
|
@@ -125,4 +125,14 @@ function calculateResultOutcome(outcomes) {
|
|
|
125
125
|
throw new Error('Cannot calculate result outcome');
|
|
126
126
|
}
|
|
127
127
|
exports.calculateResultOutcome = calculateResultOutcome;
|
|
128
|
+
function parsedAutotests(autotests, configurationId) {
|
|
129
|
+
var resolvedAutotests = [];
|
|
130
|
+
for (const autotest of autotests) {
|
|
131
|
+
if (configurationId === autotest.configurationId) {
|
|
132
|
+
resolvedAutotests.push(autotest.autoTest.externalId);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return resolvedAutotests;
|
|
136
|
+
}
|
|
137
|
+
exports.parsedAutotests = parsedAutotests;
|
|
128
138
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEA,uCAAyD;AAEzD,SAAgB,UAAU,CAAC,GAAW;IACpC,IAAI,IAAI,MAAM,CAAC,KAAK,WAAI,CAAC,UAAU,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACpD,OAAO,cAAO,CAAC,UAAU,CAAC;KAC3B;IACD,IAAI,IAAI,MAAM,CAAC,KAAK,WAAI,CAAC,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC/C,sBAAsB;QACtB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrB,O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,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,EAAE;QACpD,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,EAAE;QACrD,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,EAAE;QACrD,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,QAAQ,CAAC,EAAE;QACrD,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;AACrD,CAAC;AAhBD,wDAgBC;AAED,SAAgB,eAAe,CAC3B,SAA+B,EAC/B,eAAuB;IAEzB,IAAI,iBAAiB,GAAG,EAAE,CAAC;IAC3B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAChC,IAAI,eAAe,KAAK,QAAQ,CAAC,eAAe,EAAE;YAChD,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAS,CAAC,UAAU,CAAC,CAAC;SACvD;KACF;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAXD,0CAWC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testit-adapter-cucumber",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Adapter provides formatter for cucumber output and some additional methods to Cucumber world.",
|
|
5
5
|
"main": "dist/formatter.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@cucumber/cucumber": "^7.3.1",
|
|
21
21
|
"@cucumber/messages": "^17.1.1",
|
|
22
|
-
"testit-api-client": "^1.0.
|
|
22
|
+
"testit-api-client": "^1.0.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/preset-env": "^7.15.8",
|
package/src/formatter.ts
CHANGED
|
@@ -23,11 +23,13 @@ import { Storage } from './storage';
|
|
|
23
23
|
import { IFormatter } from './types/formatter';
|
|
24
24
|
import { AutotestPostWithWorkItemId } from './mappers';
|
|
25
25
|
import { AxiosError } from 'axios';
|
|
26
|
+
import { parseTags, parsedAutotests } from './utils';
|
|
26
27
|
|
|
27
28
|
export class TestItFormatter extends Formatter implements IFormatter {
|
|
28
29
|
client: IClient;
|
|
29
30
|
storage: IStorage = new Storage();
|
|
30
31
|
currentTestCaseId: string | undefined;
|
|
32
|
+
resolvedAutotests: Array<string | undefined> | undefined;
|
|
31
33
|
|
|
32
34
|
constructor(
|
|
33
35
|
options: IFormatterOptions,
|
|
@@ -43,7 +45,19 @@ export class TestItFormatter extends Formatter implements IFormatter {
|
|
|
43
45
|
return this.onGherkinDocument(envelope.gherkinDocument);
|
|
44
46
|
}
|
|
45
47
|
if (envelope.pickle) {
|
|
46
|
-
|
|
48
|
+
if (this.resolvedAutotests !== undefined) {
|
|
49
|
+
if (this.resolvedAutotests.length > 0) {
|
|
50
|
+
const tags = parseTags(envelope.pickle.tags);
|
|
51
|
+
for (const externalId of this.resolvedAutotests) {
|
|
52
|
+
if (externalId === tags.externalId) {
|
|
53
|
+
return this.onPickle(envelope.pickle);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
envelope.pickle = undefined;
|
|
58
|
+
} else {
|
|
59
|
+
return this.onPickle(envelope.pickle);
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
if (envelope.testCase) {
|
|
49
63
|
return this.onTestCase(envelope.testCase);
|
|
@@ -80,7 +94,7 @@ export class TestItFormatter extends Formatter implements IFormatter {
|
|
|
80
94
|
private attachmentsQueue: Promise<void>[] = [];
|
|
81
95
|
|
|
82
96
|
onMeta(_meta: Meta): void {
|
|
83
|
-
const { projectId, testRunId } = this.client.getConfig();
|
|
97
|
+
const { projectId, testRunId, configurationId } = this.client.getConfig();
|
|
84
98
|
if (testRunId === undefined) {
|
|
85
99
|
this.testRunId = this.client
|
|
86
100
|
.createTestRun({
|
|
@@ -89,6 +103,8 @@ export class TestItFormatter extends Formatter implements IFormatter {
|
|
|
89
103
|
.then((testRun) => testRun.id);
|
|
90
104
|
} else {
|
|
91
105
|
this.testRunId = Promise.resolve(testRunId);
|
|
106
|
+
const responce = this.client.getTestRun(testRunId);
|
|
107
|
+
this.resolvedAutotests = parsedAutotests(responce.testResults!, configurationId);
|
|
92
108
|
}
|
|
93
109
|
}
|
|
94
110
|
|
|
@@ -132,46 +148,49 @@ export class TestItFormatter extends Formatter implements IFormatter {
|
|
|
132
148
|
}
|
|
133
149
|
|
|
134
150
|
onTestRunFinished(_testRunFinished: TestRunFinished): void {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
if (this.testRunId === undefined) {
|
|
152
|
+
throw new Error('TestRunId is not yet specified');
|
|
153
|
+
}
|
|
154
|
+
if (this.testRunStarted === undefined) {
|
|
155
|
+
throw new Error('Test run is not started yet');
|
|
156
|
+
}
|
|
141
157
|
|
|
142
|
-
|
|
143
|
-
this.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
await Promise.all(
|
|
154
|
-
autotests.map((autotestPost) => {
|
|
155
|
-
const result = results.find(
|
|
156
|
-
(result) => result.autotestExternalId === autotestPost.externalId
|
|
158
|
+
const { configurationId } = this.client.getConfig();
|
|
159
|
+
const results = this.storage.getTestRunResults(configurationId);
|
|
160
|
+
if (results.length > 0) {
|
|
161
|
+
Promise.all([
|
|
162
|
+
this.testRunId,
|
|
163
|
+
this.testRunStarted,
|
|
164
|
+
Promise.all(this.attachmentsQueue),
|
|
165
|
+
])
|
|
166
|
+
.then(async ([id]) => {
|
|
167
|
+
const autotests = this.storage.getAutotests(
|
|
168
|
+
this.client.getConfig().projectId
|
|
157
169
|
);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
170
|
+
await Promise.all(
|
|
171
|
+
autotests.map((autotestPost) => {
|
|
172
|
+
const result = results.find(
|
|
173
|
+
(result) => result.autotestExternalId === autotestPost.externalId
|
|
174
|
+
);
|
|
175
|
+
if (result !== undefined) {
|
|
176
|
+
if (result.outcome !== 'Passed') {
|
|
177
|
+
return this.loadAutotest(autotestPost);
|
|
178
|
+
}
|
|
179
|
+
return this.loadPassedAutotest(autotestPost);
|
|
180
|
+
}
|
|
181
|
+
})
|
|
161
182
|
);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this.testRunId?.then((id) => this.client.completeTestRun(id));
|
|
174
|
-
});
|
|
183
|
+
await Promise.all(
|
|
184
|
+
results.map((result) => {
|
|
185
|
+
return this.client.loadTestRunResults(id, [result]);
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
})
|
|
189
|
+
.catch((err) => {
|
|
190
|
+
console.error(err);
|
|
191
|
+
this.testRunId?.then((id) => this.client.completeTestRun(id));
|
|
192
|
+
});
|
|
193
|
+
}
|
|
175
194
|
}
|
|
176
195
|
|
|
177
196
|
async loadAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void> {
|
package/src/storage.ts
CHANGED
|
@@ -64,66 +64,65 @@ export class Storage implements IStorage {
|
|
|
64
64
|
getTestRunResults(configurationId: string): AutotestResultsForTestRun[] {
|
|
65
65
|
const results: AutotestResultsForTestRun[] = [];
|
|
66
66
|
for (const pickle of this.pickles) {
|
|
67
|
-
const tags = parseTags(pickle.tags);
|
|
68
|
-
if (tags.externalId === undefined) {
|
|
69
|
-
throw new Error('External id is not provided');
|
|
70
|
-
}
|
|
71
67
|
const testCase = this.testCases.find(
|
|
72
68
|
(testCase) => testCase.pickleId === pickle.id
|
|
73
69
|
);
|
|
74
|
-
if (testCase
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
70
|
+
if (testCase !== undefined) {
|
|
71
|
+
const tags = parseTags(pickle.tags);
|
|
72
|
+
if (tags.externalId === undefined) {
|
|
73
|
+
throw new Error('External id is not provided');
|
|
74
|
+
}
|
|
75
|
+
const testCaseStarted = this.testCasesStarted.find(
|
|
76
|
+
(testCase) => testCase.id === testCase.id
|
|
77
|
+
);
|
|
78
|
+
if (testCaseStarted === undefined) {
|
|
79
|
+
throw new Error('TestCaseStarted not found');
|
|
80
|
+
}
|
|
81
|
+
const testCaseFinished = this.testCasesFinished.find(
|
|
82
|
+
(testCase) => testCase.testCaseStartedId === testCaseStarted.id
|
|
83
|
+
);
|
|
84
|
+
if (testCaseFinished === undefined) {
|
|
85
|
+
throw new Error('TestCaseFinished not found');
|
|
86
|
+
}
|
|
87
|
+
const steps = pickle.steps
|
|
88
|
+
.map((step) => this.getStepResult(step, testCase))
|
|
89
|
+
.filter((item, i, arr) => {
|
|
90
|
+
const prevOutcome = arr[i - 1]?.outcome;
|
|
91
|
+
if (
|
|
92
|
+
item.outcome === 'Skipped' &&
|
|
93
|
+
prevOutcome !== undefined &&
|
|
94
|
+
['Failed', 'Skipped'].includes(prevOutcome)
|
|
95
|
+
) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
});
|
|
100
|
+
const messages: string[] = [];
|
|
101
|
+
for (const step of pickle.steps) {
|
|
102
|
+
const message = this.getStepMessage(step, testCase);
|
|
103
|
+
if (message !== undefined) {
|
|
104
|
+
messages.push(message);
|
|
99
105
|
}
|
|
100
|
-
return true;
|
|
101
|
-
});
|
|
102
|
-
const messages: string[] = [];
|
|
103
|
-
for (const step of pickle.steps) {
|
|
104
|
-
const message = this.getStepMessage(step, testCase);
|
|
105
|
-
if (message !== undefined) {
|
|
106
|
-
messages.push(message);
|
|
107
106
|
}
|
|
107
|
+
const links = this.links[testCase.id] ?? [];
|
|
108
|
+
links.push(...tags.links);
|
|
109
|
+
const result: AutotestResultsForTestRun = {
|
|
110
|
+
autotestExternalId: tags.externalId,
|
|
111
|
+
configurationId,
|
|
112
|
+
links,
|
|
113
|
+
stepResults: steps,
|
|
114
|
+
outcome: calculateResultOutcome(steps.map((step) => step.outcome)),
|
|
115
|
+
startedOn: mapDate(testCaseStarted.timestamp.seconds),
|
|
116
|
+
completeOn: mapDate(testCaseFinished.timestamp.seconds),
|
|
117
|
+
duration:
|
|
118
|
+
testCaseFinished.timestamp.seconds -
|
|
119
|
+
testCaseStarted.timestamp.seconds,
|
|
120
|
+
message: this.messages[testCase.id]?.join('\n\n') ?? undefined,
|
|
121
|
+
traces: messages.join('\n\n'),
|
|
122
|
+
attachments: this.getAttachments(testCase.id),
|
|
123
|
+
};
|
|
124
|
+
results.push(result);
|
|
108
125
|
}
|
|
109
|
-
const links = this.links[testCase.id] ?? [];
|
|
110
|
-
links.push(...tags.links);
|
|
111
|
-
const result: AutotestResultsForTestRun = {
|
|
112
|
-
autotestExternalId: tags.externalId,
|
|
113
|
-
configurationId,
|
|
114
|
-
links,
|
|
115
|
-
stepResults: steps,
|
|
116
|
-
outcome: calculateResultOutcome(steps.map((step) => step.outcome)),
|
|
117
|
-
startedOn: mapDate(testCaseStarted.timestamp.seconds),
|
|
118
|
-
completeOn: mapDate(testCaseFinished.timestamp.seconds),
|
|
119
|
-
duration:
|
|
120
|
-
testCaseFinished.timestamp.seconds -
|
|
121
|
-
testCaseStarted.timestamp.seconds,
|
|
122
|
-
message: this.messages[testCase.id]?.join('\n\n') ?? undefined,
|
|
123
|
-
traces: messages.join('\n\n'),
|
|
124
|
-
attachments: this.getAttachments(testCase.id),
|
|
125
|
-
};
|
|
126
|
-
results.push(result);
|
|
127
126
|
}
|
|
128
127
|
|
|
129
128
|
return results;
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tag } from '@cucumber/messages';
|
|
2
|
-
import { Link, OutcomeType } from 'testit-api-client';
|
|
2
|
+
import { Link, OutcomeType, TestResultGet, TestRunGet } from 'testit-api-client';
|
|
3
3
|
import { ParsedTags, tags, TagType } from './types/tags';
|
|
4
4
|
|
|
5
5
|
export function getTagType(tag: string): TagType {
|
|
@@ -125,3 +125,16 @@ export function calculateResultOutcome(
|
|
|
125
125
|
}
|
|
126
126
|
throw new Error('Cannot calculate result outcome');
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
export function parsedAutotests(
|
|
130
|
+
autotests: Array<TestResultGet>,
|
|
131
|
+
configurationId: string
|
|
132
|
+
): Array<string | undefined> {
|
|
133
|
+
var resolvedAutotests = [];
|
|
134
|
+
for (const autotest of autotests) {
|
|
135
|
+
if (configurationId === autotest.configurationId) {
|
|
136
|
+
resolvedAutotests.push(autotest.autoTest!.externalId);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return resolvedAutotests;
|
|
140
|
+
}
|
package/readme.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# TestIt Cucumber Adapter
|
|
2
|
-
|
|
3
|
-
Adapter provides formatter for cucumber output and some additional methods to Cucumber world.
|
|
4
|
-
|
|
5
|
-
# Installation
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
npm i <TBD>
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
or
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
yarn add <TBD>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
# Usage
|
|
18
|
-
|
|
19
|
-
Create `formatter.js` file with
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
const { TestItFormatter } = require('<TBD>');
|
|
23
|
-
|
|
24
|
-
module.exports = class CustomFormatter extends TestItFormatter {
|
|
25
|
-
constructor(options) {
|
|
26
|
-
super(options, {
|
|
27
|
-
url: '<url>',
|
|
28
|
-
privateToken: '<token>',
|
|
29
|
-
projectId: '<id>',
|
|
30
|
-
configurationId: '<id>',
|
|
31
|
-
testRunId: '<optional id>',
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
And fill object with your configuration. Formatter sends results to TestIt.
|
|
38
|
-
|
|
39
|
-
> TestRunId is optional. If it's not provided than it create automatically.
|
|
40
|
-
|
|
41
|
-
Add to `cucumber.js` file
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
module.exports = {
|
|
45
|
-
default:
|
|
46
|
-
'-f ./testitFormatter.js',
|
|
47
|
-
};
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Formatter provides additional methods to World:
|
|
51
|
-
|
|
52
|
-
- addMessage - adds message to autotest
|
|
53
|
-
- addLinks - adds links to autotest
|
|
54
|
-
- addAttachments - uploads specified to TestIt and links to test run
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
When('Something happens', function () {
|
|
58
|
-
this.addMessage('💔');
|
|
59
|
-
this.addLinks([
|
|
60
|
-
{
|
|
61
|
-
url: 'http://github.com',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
url: 'https://wikipedia.org',
|
|
65
|
-
title: 'Wikipedia',
|
|
66
|
-
description: 'The free encyclopedia',
|
|
67
|
-
type: 'Related',
|
|
68
|
-
hasInfo: true,
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
this.addAttachments(['path/to/file.txt']);
|
|
72
|
-
});
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
# Tags
|
|
76
|
-
|
|
77
|
-
Cucumber tags can be used to specify information about autotest.
|
|
78
|
-
|
|
79
|
-
> Only those specified above the `Scenario` are taken into account
|
|
80
|
-
|
|
81
|
-
- `@ExternalId` - Unique identifier of autotest (Required)
|
|
82
|
-
- `@Title` - Title that is displayed on autotest page
|
|
83
|
-
- `@DisplayName` - Name that is displayed in autotests table
|
|
84
|
-
- `@Description` - Autotest description
|
|
85
|
-
- `@Link` - can be specified either in JSON (`@Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}`) or in text (`@Link=http://google.com`)
|
|
86
|
-
- `@Label` - Label that is going to be linked to autotest
|
|
87
|
-
- `@WorkItemID` - Work item's ID to which autotest is going to be linked
|