testit-adapter-cucumber 1.0.2 → 1.0.5
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/LICENSE.md +202 -0
- package/README.md +144 -0
- package/dist/formatter.d.ts +1 -0
- package/dist/formatter.js +47 -28
- package/dist/formatter.js.map +1 -1
- package/dist/mappers.js +7 -2
- package/dist/mappers.js.map +1 -1
- package/dist/storage.js +44 -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/mappers.ts +7 -2
- package/src/storage.ts +50 -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/LICENSE.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2022 Test IT
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Test IT TMS adapters for JavaScript
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
# Cucumber
|
|
5
|
+
|
|
6
|
+
## Getting Started
|
|
7
|
+
|
|
8
|
+
### Installation
|
|
9
|
+
```
|
|
10
|
+
npm install testit-adapter-cucumber
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### API client
|
|
16
|
+
|
|
17
|
+
To use adapter you need to install `testit-api-client`:
|
|
18
|
+
```
|
|
19
|
+
npm install testit-api-client
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Configuration
|
|
23
|
+
|
|
24
|
+
Create `testitFormatter.js` file in the root directory of the project:
|
|
25
|
+
```js
|
|
26
|
+
const { TestItFormatter } = require('testit-adapter-cucumber');
|
|
27
|
+
|
|
28
|
+
module.exports = class CustomFormatter extends TestItFormatter {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(options, {
|
|
31
|
+
url: '<url>',
|
|
32
|
+
privateToken: '<token>',
|
|
33
|
+
projectId: '<id>',
|
|
34
|
+
configurationId: '<id>',
|
|
35
|
+
testRunId: '<optional id>',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
And fill object with your configuration. Formatter sends results to Test IT.
|
|
42
|
+
|
|
43
|
+
> TestRunId is optional. If it's not provided than it create automatically.
|
|
44
|
+
|
|
45
|
+
Add to `cucumber.js` file
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
module.exports = {
|
|
49
|
+
default:
|
|
50
|
+
'-f ./testitFormatter.js',
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Tags
|
|
55
|
+
|
|
56
|
+
Formatter provides additional methods to World:
|
|
57
|
+
|
|
58
|
+
- addMessage - adds message to autotest
|
|
59
|
+
- addLinks - adds links to autotest
|
|
60
|
+
- addAttachments - uploads specified to Test IT and links to test run
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
When('Something happens', function () {
|
|
64
|
+
this.addMessage('💔');
|
|
65
|
+
this.addLinks([
|
|
66
|
+
{
|
|
67
|
+
url: 'http://github.com',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
url: 'https://wikipedia.org',
|
|
71
|
+
title: 'Wikipedia',
|
|
72
|
+
description: 'The free encyclopedia',
|
|
73
|
+
type: 'Related',
|
|
74
|
+
hasInfo: true,
|
|
75
|
+
},
|
|
76
|
+
]);
|
|
77
|
+
this.addAttachments(['path/to/file.txt']);
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Cucumber tags can be used to specify information about autotest.
|
|
82
|
+
|
|
83
|
+
> Only those specified above the `Scenario` are taken into account
|
|
84
|
+
|
|
85
|
+
- `@ExternalId` - Unique identifier of autotest (Required)
|
|
86
|
+
- `@Title` - Title that is displayed on autotest page
|
|
87
|
+
- `@DisplayName` - Name that is displayed in autotests table
|
|
88
|
+
- `@Description` - Autotest description
|
|
89
|
+
- `@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`)
|
|
90
|
+
- `@Label` - Label that is going to be linked to autotest
|
|
91
|
+
- `@WorkItemId` - Work item's ID to which autotest is going to be linked
|
|
92
|
+
|
|
93
|
+
### Examples
|
|
94
|
+
|
|
95
|
+
#### Tags
|
|
96
|
+
```
|
|
97
|
+
Feature: Tags
|
|
98
|
+
@DisplayName=GoogiliGoogle
|
|
99
|
+
@Description=Cannot_Write_With_Spaces
|
|
100
|
+
@ExternalId=344
|
|
101
|
+
@Link=http://google.com
|
|
102
|
+
@Link=http://vk.com
|
|
103
|
+
@Label=Maths
|
|
104
|
+
@Label=School
|
|
105
|
+
Scenario: Scenario with links
|
|
106
|
+
When 2+2
|
|
107
|
+
Then Result is 4
|
|
108
|
+
@Title=LINKS
|
|
109
|
+
@ExternalId=343
|
|
110
|
+
@Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}
|
|
111
|
+
Scenario: Scenario with link obj
|
|
112
|
+
When 2+2
|
|
113
|
+
Then Result is 4
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Parameterized test
|
|
117
|
+
```
|
|
118
|
+
Feature: Rule
|
|
119
|
+
Tests that use Rule
|
|
120
|
+
@ExternalId=999
|
|
121
|
+
Scenario: Summing
|
|
122
|
+
When <left>+<right>
|
|
123
|
+
Then Result is <result>
|
|
124
|
+
|
|
125
|
+
Examples: Options
|
|
126
|
+
Examples show different options
|
|
127
|
+
| left | right | result |
|
|
128
|
+
| 1 | 1 | 3 |
|
|
129
|
+
| 9 | 9 | 18 |
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
# Contributing
|
|
133
|
+
|
|
134
|
+
You can help to develop the project. Any contributions are **greatly appreciated**.
|
|
135
|
+
|
|
136
|
+
* If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testit-tms/adapters-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
|
|
137
|
+
* Please make sure you check your spelling and grammar.
|
|
138
|
+
* Create individual PR for each suggestion.
|
|
139
|
+
* Please also read through the [Code Of Conduct](https://github.com/testit-tms/adapters-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.
|
|
140
|
+
|
|
141
|
+
# License
|
|
142
|
+
|
|
143
|
+
Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
|
|
144
|
+
|
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,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AC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,cAAc,CAAC,WAAqB;QAClC,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACjD;QACD,MAAM,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/mappers.js
CHANGED
|
@@ -68,7 +68,11 @@ function mapScenario(scenario, projectId, setup) {
|
|
|
68
68
|
var _a, _b;
|
|
69
69
|
const tags = (0, utils_1.parseTags)(scenario.tags);
|
|
70
70
|
if (tags.externalId === undefined) {
|
|
71
|
-
|
|
71
|
+
return {
|
|
72
|
+
externalId: '',
|
|
73
|
+
name: scenario.name,
|
|
74
|
+
projectId
|
|
75
|
+
};
|
|
72
76
|
}
|
|
73
77
|
const exampleSteps = scenario.examples.map(mapExamples);
|
|
74
78
|
return {
|
|
@@ -89,6 +93,7 @@ function mapScenario(scenario, projectId, setup) {
|
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
95
|
exports.mapScenario = mapScenario;
|
|
96
|
+
//TODO: Implement using "parameters" fields
|
|
92
97
|
function mapExamples(examples) {
|
|
93
98
|
var _a, _b, _c, _d;
|
|
94
99
|
let table = [];
|
|
@@ -109,7 +114,7 @@ function mapExamples(examples) {
|
|
|
109
114
|
description.push(JSON.stringify(table));
|
|
110
115
|
}
|
|
111
116
|
return {
|
|
112
|
-
title: (_c = (_b = tags.title) !== null && _b !== void 0 ? _b : tags.name) !== null && _c !== void 0 ? _c : examples.name,
|
|
117
|
+
title: (_c = (_b = tags.title) !== null && _b !== void 0 ? _b : tags.name) !== null && _c !== void 0 ? _c : (examples.name !== '' ? examples.name : 'Parameters'),
|
|
113
118
|
description: (_d = tags.description) !== null && _d !== void 0 ? _d : description.join('\n\n'),
|
|
114
119
|
};
|
|
115
120
|
}
|
package/dist/mappers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":";;;AAAA,iDAS4B;AAE5B,mCAAoC;AAMpC,SAAgB,SAAS,CAAC,MAA4B;IACpD,QAAQ,MAAM,EAAE;QACd,KAAK,+BAAoB,CAAC,MAAM;YAC9B,OAAO,QAAQ,CAAC;QAClB,KAAK,+BAAoB,CAAC,MAAM;YAC9B,OAAO,QAAQ,CAAC;QAClB,KAAK,+BAAoB,CAAC,OAAO;YAC/B,OAAO,SAAS,CAAC;QACnB,KAAK,+BAAoB,CAAC,OAAO;YAC/B,OAAO,SAAS,CAAC;QACnB,KAAK,+BAAoB,CAAC,OAAO,CAAC;QAClC,KAAK,+BAAoB,CAAC,SAAS,CAAC;QACpC,KAAK,+BAAoB,CAAC,SAAS;YACjC,OAAO,SAAS,CAAC;QAC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0BAKC;AAED,SAAgB,YAAY,CAC1B,SAAgC;IAEhC,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI;SACxB,KAAK,CAAC,CAAC,CAAC;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACjC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;QAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAA4B,CAAC,CACjC,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAjBD,oCAiBC"}
|
package/dist/storage.js
CHANGED
|
@@ -44,58 +44,54 @@ 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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
throw new Error('TestCaseFinished not found');
|
|
62
|
-
}
|
|
63
|
-
const steps = pickle.steps
|
|
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
|
+
const tags = (0, utils_1.parseTags)(pickle.tags);
|
|
49
|
+
if (testCase !== undefined && tags.externalId !== undefined) {
|
|
50
|
+
const testCaseStarted = this.testCasesStarted.find((testCase) => testCase.id === testCase.id);
|
|
51
|
+
if (testCaseStarted === undefined) {
|
|
52
|
+
throw new Error('TestCaseStarted not found');
|
|
53
|
+
}
|
|
54
|
+
const testCaseFinished = this.testCasesFinished.find((testCase) => testCase.testCaseStartedId === testCaseStarted.id);
|
|
55
|
+
if (testCaseFinished === undefined) {
|
|
56
|
+
throw new Error('TestCaseFinished not found');
|
|
72
57
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
const steps = pickle.steps
|
|
59
|
+
.map((step) => this.getStepResult(step, testCase))
|
|
60
|
+
.filter((item, i, arr) => {
|
|
61
|
+
var _a;
|
|
62
|
+
const prevOutcome = (_a = arr[i - 1]) === null || _a === void 0 ? void 0 : _a.outcome;
|
|
63
|
+
if (item.outcome === 'Skipped' &&
|
|
64
|
+
prevOutcome !== undefined &&
|
|
65
|
+
['Failed', 'Skipped'].includes(prevOutcome)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
const messages = [];
|
|
71
|
+
for (const step of pickle.steps) {
|
|
72
|
+
const message = this.getStepMessage(step, testCase);
|
|
73
|
+
if (message !== undefined) {
|
|
74
|
+
messages.push(message);
|
|
75
|
+
}
|
|
80
76
|
}
|
|
77
|
+
const links = (_a = this.links[testCase.id]) !== null && _a !== void 0 ? _a : [];
|
|
78
|
+
links.push(...tags.links);
|
|
79
|
+
const result = {
|
|
80
|
+
autotestExternalId: tags.externalId,
|
|
81
|
+
configurationId,
|
|
82
|
+
links,
|
|
83
|
+
stepResults: steps,
|
|
84
|
+
outcome: (0, utils_1.calculateResultOutcome)(steps.map((step) => step.outcome)),
|
|
85
|
+
startedOn: (0, mappers_1.mapDate)(testCaseStarted.timestamp.seconds),
|
|
86
|
+
completeOn: (0, mappers_1.mapDate)(testCaseFinished.timestamp.seconds),
|
|
87
|
+
duration: testCaseFinished.timestamp.seconds -
|
|
88
|
+
testCaseStarted.timestamp.seconds,
|
|
89
|
+
message: (_c = (_b = this.messages[testCase.id]) === null || _b === void 0 ? void 0 : _b.join('\n\n')) !== null && _c !== void 0 ? _c : undefined,
|
|
90
|
+
traces: messages.join('\n\n'),
|
|
91
|
+
attachments: this.getAttachments(testCase.id),
|
|
92
|
+
};
|
|
93
|
+
results.push(result);
|
|
81
94
|
}
|
|
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
95
|
}
|
|
100
96
|
return results;
|
|
101
97
|
}
|
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;IA4KrD,CAAC;IA1KC,mBAAmB,CAAC,QAAyB;QAC3C,IAAI,CAAC,gBAAgB,CAAC,I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,SAAS,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;AAtLD,0BAsLC"}
|
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;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C,IAAI,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.5",
|
|
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/mappers.ts
CHANGED
|
@@ -96,7 +96,11 @@ export function mapScenario(
|
|
|
96
96
|
): AutotestPostWithWorkItemId {
|
|
97
97
|
const tags = parseTags(scenario.tags);
|
|
98
98
|
if (tags.externalId === undefined) {
|
|
99
|
-
|
|
99
|
+
return {
|
|
100
|
+
externalId: '',
|
|
101
|
+
name: scenario.name,
|
|
102
|
+
projectId
|
|
103
|
+
};
|
|
100
104
|
}
|
|
101
105
|
const exampleSteps = scenario.examples.map(mapExamples);
|
|
102
106
|
return {
|
|
@@ -117,6 +121,7 @@ export function mapScenario(
|
|
|
117
121
|
};
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
//TODO: Implement using "parameters" fields
|
|
120
125
|
export function mapExamples(examples: Examples): AutotestStep {
|
|
121
126
|
let table: string[][] | Record<string, string>[] = [];
|
|
122
127
|
const body = examples.tableBody.map((row) =>
|
|
@@ -142,7 +147,7 @@ export function mapExamples(examples: Examples): AutotestStep {
|
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
return {
|
|
145
|
-
title: tags.title ?? tags.name ?? examples.name,
|
|
150
|
+
title: tags.title ?? tags.name ?? (examples.name !== '' ? examples.name : 'Parameters'),
|
|
146
151
|
description: tags.description ?? description.join('\n\n'),
|
|
147
152
|
};
|
|
148
153
|
}
|
package/src/storage.ts
CHANGED
|
@@ -64,66 +64,62 @@ 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
|
-
|
|
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
|
+
const tags = parseTags(pickle.tags);
|
|
71
|
+
if (testCase !== undefined && tags.externalId !== undefined) {
|
|
72
|
+
const testCaseStarted = this.testCasesStarted.find(
|
|
73
|
+
(testCase) => testCase.id === testCase.id
|
|
74
|
+
);
|
|
75
|
+
if (testCaseStarted === undefined) {
|
|
76
|
+
throw new Error('TestCaseStarted not found');
|
|
77
|
+
}
|
|
78
|
+
const testCaseFinished = this.testCasesFinished.find(
|
|
79
|
+
(testCase) => testCase.testCaseStartedId === testCaseStarted.id
|
|
80
|
+
);
|
|
81
|
+
if (testCaseFinished === undefined) {
|
|
82
|
+
throw new Error('TestCaseFinished not found');
|
|
83
|
+
}
|
|
84
|
+
const steps = pickle.steps
|
|
85
|
+
.map((step) => this.getStepResult(step, testCase))
|
|
86
|
+
.filter((item, i, arr) => {
|
|
87
|
+
const prevOutcome = arr[i - 1]?.outcome;
|
|
88
|
+
if (
|
|
89
|
+
item.outcome === 'Skipped' &&
|
|
90
|
+
prevOutcome !== undefined &&
|
|
91
|
+
['Failed', 'Skipped'].includes(prevOutcome)
|
|
92
|
+
) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
const messages: string[] = [];
|
|
98
|
+
for (const step of pickle.steps) {
|
|
99
|
+
const message = this.getStepMessage(step, testCase);
|
|
100
|
+
if (message !== undefined) {
|
|
101
|
+
messages.push(message);
|
|
99
102
|
}
|
|
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
103
|
}
|
|
104
|
+
const links = this.links[testCase.id] ?? [];
|
|
105
|
+
links.push(...tags.links);
|
|
106
|
+
const result: AutotestResultsForTestRun = {
|
|
107
|
+
autotestExternalId: tags.externalId,
|
|
108
|
+
configurationId,
|
|
109
|
+
links,
|
|
110
|
+
stepResults: steps,
|
|
111
|
+
outcome: calculateResultOutcome(steps.map((step) => step.outcome)),
|
|
112
|
+
startedOn: mapDate(testCaseStarted.timestamp.seconds),
|
|
113
|
+
completeOn: mapDate(testCaseFinished.timestamp.seconds),
|
|
114
|
+
duration:
|
|
115
|
+
testCaseFinished.timestamp.seconds -
|
|
116
|
+
testCaseStarted.timestamp.seconds,
|
|
117
|
+
message: this.messages[testCase.id]?.join('\n\n') ?? undefined,
|
|
118
|
+
traces: messages.join('\n\n'),
|
|
119
|
+
attachments: this.getAttachments(testCase.id),
|
|
120
|
+
};
|
|
121
|
+
results.push(result);
|
|
108
122
|
}
|
|
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
123
|
}
|
|
128
124
|
|
|
129
125
|
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
|