testit-adapter-cucumber 1.1.2 → 1.1.4
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/.eslintignore +1 -1
- package/.eslintrc.json +27 -27
- package/.prettierrc +9 -9
- package/README.md +152 -149
- package/dist/formatter.d.ts +35 -35
- package/dist/formatter.js +224 -224
- package/dist/mappers.d.ts +14 -14
- package/dist/mappers.js +146 -144
- package/dist/mappers.js.map +1 -1
- package/dist/storage.d.ts +32 -32
- package/dist/storage.js +174 -174
- package/dist/types/formatter.d.ts +25 -25
- package/dist/types/formatter.js +2 -2
- package/dist/types/storage.d.ts +18 -18
- package/dist/types/storage.js +2 -2
- package/dist/types/tags.d.ts +26 -22
- package/dist/types/tags.js +28 -24
- package/dist/types/tags.js.map +1 -1
- package/dist/types/world.d.ts +7 -7
- package/dist/types/world.js +2 -2
- package/dist/utils.d.ts +17 -15
- package/dist/utils.js +159 -137
- package/dist/utils.js.map +1 -1
- package/package.json +49 -49
- package/src/formatter.ts +285 -285
- package/src/mappers.ts +181 -179
- package/src/storage.ts +212 -212
- package/src/types/formatter.ts +37 -37
- package/src/types/storage.ts +27 -27
- package/src/types/tags.ts +39 -33
- package/src/types/world.ts +8 -8
- package/src/utils.ts +162 -140
- package/tsconfig.json +101 -101
- package/.vs/VSWorkspaceState.json +0 -8
- 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/testit-adapter-cucumber-1.1.2.tgz +0 -0
package/.eslintignore
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
dist/*
|
|
1
|
+
dist/*
|
|
2
2
|
demo/*
|
package/.eslintrc.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es2021": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended",
|
|
9
|
-
"plugin:prettier/recommended",
|
|
10
|
-
"prettier"
|
|
11
|
-
],
|
|
12
|
-
"parser": "@typescript-eslint/parser",
|
|
13
|
-
"parserOptions": {
|
|
14
|
-
"ecmaVersion": 12,
|
|
15
|
-
"sourceType": "module"
|
|
16
|
-
},
|
|
17
|
-
"plugins": ["@typescript-eslint", "prettier"],
|
|
18
|
-
"rules": {
|
|
19
|
-
"no-unused-vars": "off",
|
|
20
|
-
"@typescript-eslint/no-unused-vars": [
|
|
21
|
-
"error",
|
|
22
|
-
{ "argsIgnorePattern": "^_" }
|
|
23
|
-
],
|
|
24
|
-
"prettier/prettier": "warn",
|
|
25
|
-
"@typescript-eslint/explicit-function-return-type": "error"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2021": true,
|
|
4
|
+
"node": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"plugin:prettier/recommended",
|
|
10
|
+
"prettier"
|
|
11
|
+
],
|
|
12
|
+
"parser": "@typescript-eslint/parser",
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"ecmaVersion": 12,
|
|
15
|
+
"sourceType": "module"
|
|
16
|
+
},
|
|
17
|
+
"plugins": ["@typescript-eslint", "prettier"],
|
|
18
|
+
"rules": {
|
|
19
|
+
"no-unused-vars": "off",
|
|
20
|
+
"@typescript-eslint/no-unused-vars": [
|
|
21
|
+
"error",
|
|
22
|
+
{ "argsIgnorePattern": "^_" }
|
|
23
|
+
],
|
|
24
|
+
"prettier/prettier": "warn",
|
|
25
|
+
"@typescript-eslint/explicit-function-return-type": "error"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/.prettierrc
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"endOfLine": "lf",
|
|
3
|
-
"printWidth": 80,
|
|
4
|
-
"semi": true,
|
|
5
|
-
"singleQuote": true,
|
|
6
|
-
"useTabs": false,
|
|
7
|
-
"trailingComma": "es5",
|
|
8
|
-
"tabWidth": 2
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"endOfLine": "lf",
|
|
3
|
+
"printWidth": 80,
|
|
4
|
+
"semi": true,
|
|
5
|
+
"singleQuote": true,
|
|
6
|
+
"useTabs": false,
|
|
7
|
+
"trailingComma": "es5",
|
|
8
|
+
"tabWidth": 2
|
|
9
|
+
}
|
package/README.md
CHANGED
|
@@ -1,149 +1,152 @@
|
|
|
1
|
-
# Test IT TMS adapters for Cucumber
|
|
2
|
-

|
|
3
|
-
|
|
4
|
-
## Getting Started
|
|
5
|
-
|
|
6
|
-
###
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
###
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@
|
|
107
|
-
@
|
|
108
|
-
@
|
|
109
|
-
@
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
# Test IT TMS adapters for Cucumber
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
## Getting Started
|
|
5
|
+
|
|
6
|
+
### Installation
|
|
7
|
+
```
|
|
8
|
+
npm install testit-adapter-cucumber
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### API client
|
|
14
|
+
|
|
15
|
+
To use adapter you need to install `testit-api-client`:
|
|
16
|
+
```
|
|
17
|
+
npm install testit-api-client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Configuration
|
|
21
|
+
|
|
22
|
+
| Description | Property | Environment variable | CLI argument |
|
|
23
|
+
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|-----------------------------------|-------------------------------|
|
|
24
|
+
| Location of the TMS instance | url | TMS_URL | tmsUrl |
|
|
25
|
+
| API secret key [How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) | privateToken | TMS_PRIVATE_TOKEN | tmsPrivateToken |
|
|
26
|
+
| ID of project in TMS instance [How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid) | projectId | TMS_PROJECT_ID | tmsProjectId |
|
|
27
|
+
| ID of configuration in TMS instance [How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) | configurationId | TMS_CONFIGURATION_ID | tmsConfigurationId |
|
|
28
|
+
| ID of the created test run in TMS instance | testRunId | TMS_TEST_RUN_ID | tmsTestRunId |
|
|
29
|
+
|
|
30
|
+
Create `testitFormatter.js` file in the root directory of the project:
|
|
31
|
+
```js
|
|
32
|
+
const { TestItFormatter } = require('testit-adapter-cucumber');
|
|
33
|
+
|
|
34
|
+
module.exports = class CustomFormatter extends TestItFormatter {
|
|
35
|
+
constructor(options) {
|
|
36
|
+
super(options, {
|
|
37
|
+
url: 'URL',
|
|
38
|
+
privateToken: 'USER_PRIVATE_TOKEN',
|
|
39
|
+
projectId: 'PROJECT_ID',
|
|
40
|
+
configurationId: 'CONFIGURATION_ID',
|
|
41
|
+
testRunId: 'TEST_RUN_ID',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
And fill object with your configuration. Formatter sends results to Test IT.
|
|
48
|
+
|
|
49
|
+
> TestRunId is optional. If it's not provided than it create automatically.
|
|
50
|
+
|
|
51
|
+
Add to `cucumber.js` file
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
module.exports = {
|
|
55
|
+
default:
|
|
56
|
+
'-f ./testitFormatter.js',
|
|
57
|
+
};
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Tags
|
|
61
|
+
|
|
62
|
+
Formatter provides additional methods to World:
|
|
63
|
+
|
|
64
|
+
- addMessage - adds message to autotest
|
|
65
|
+
- addLinks - adds links to autotest
|
|
66
|
+
- addAttachments - uploads specified to Test IT and links to test run
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
When('Something happens', function () {
|
|
70
|
+
this.addMessage('💔');
|
|
71
|
+
this.addLinks([
|
|
72
|
+
{
|
|
73
|
+
url: 'http://github.com',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
url: 'https://wikipedia.org',
|
|
77
|
+
title: 'Wikipedia',
|
|
78
|
+
description: 'The free encyclopedia',
|
|
79
|
+
type: 'Related',
|
|
80
|
+
hasInfo: true,
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
83
|
+
this.addAttachments(['path/to/file.txt']);
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Cucumber tags can be used to specify information about autotest.
|
|
88
|
+
|
|
89
|
+
> Only those specified above the `Scenario` are taken into account
|
|
90
|
+
|
|
91
|
+
- `@ExternalId` - Unique identifier of autotest (Required)
|
|
92
|
+
- `@Title` - Title that is displayed on autotest page
|
|
93
|
+
- `@DisplayName` - Name that is displayed in autotests table
|
|
94
|
+
- `@Description` - Autotest description
|
|
95
|
+
- `@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`)
|
|
96
|
+
- `@Label` - Label that is going to be linked to autotest
|
|
97
|
+
- `@WorkItemId` - Work item's ID to which autotest is going to be linked
|
|
98
|
+
- `@NameSpace` - directory in the TMS system
|
|
99
|
+
- `@ClassName` - subdirectory in the TMS system
|
|
100
|
+
|
|
101
|
+
### Examples
|
|
102
|
+
|
|
103
|
+
#### Tags
|
|
104
|
+
```
|
|
105
|
+
Feature: Tags
|
|
106
|
+
@DisplayName=GoogiliGoogle
|
|
107
|
+
@Description=Cannot_Write_With_Spaces
|
|
108
|
+
@ExternalId=344
|
|
109
|
+
@Link=http://google.com
|
|
110
|
+
@Link=http://vk.com
|
|
111
|
+
@Label=Maths
|
|
112
|
+
@Label=School
|
|
113
|
+
Scenario: Scenario with links
|
|
114
|
+
When 2+2
|
|
115
|
+
Then Result is 4
|
|
116
|
+
@Title=LINKS
|
|
117
|
+
@ExternalId=343
|
|
118
|
+
@Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}
|
|
119
|
+
Scenario: Scenario with link obj
|
|
120
|
+
When 2+2
|
|
121
|
+
Then Result is 4
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Parameterized test
|
|
125
|
+
```
|
|
126
|
+
Feature: Rule
|
|
127
|
+
Tests that use Rule
|
|
128
|
+
@ExternalId=999
|
|
129
|
+
Scenario: Summing
|
|
130
|
+
When <left>+<right>
|
|
131
|
+
Then Result is <result>
|
|
132
|
+
|
|
133
|
+
Examples: Options
|
|
134
|
+
Examples show different options
|
|
135
|
+
| left | right | result |
|
|
136
|
+
| 1 | 1 | 3 |
|
|
137
|
+
| 9 | 9 | 18 |
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
# Contributing
|
|
141
|
+
|
|
142
|
+
You can help to develop the project. Any contributions are **greatly appreciated**.
|
|
143
|
+
|
|
144
|
+
* 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.
|
|
145
|
+
* Please make sure you check your spelling and grammar.
|
|
146
|
+
* Create individual PR for each suggestion.
|
|
147
|
+
* 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.
|
|
148
|
+
|
|
149
|
+
# License
|
|
150
|
+
|
|
151
|
+
Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
|
|
152
|
+
|
package/dist/formatter.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { Formatter, IFormatterOptions } from '@cucumber/cucumber';
|
|
2
|
-
import { GherkinDocument, Pickle, TestCase, TestStepFinished, TestRunFinished, TestCaseStarted, TestCaseFinished, TestStepStarted, Meta } from '@cucumber/messages';
|
|
3
|
-
import { ClientConfigWithFile, IClient, LinkPost } from 'testit-api-client';
|
|
4
|
-
import { IStorage } from './types/storage';
|
|
5
|
-
import { IFormatter } from './types/formatter';
|
|
6
|
-
import { AutotestPostWithWorkItemId } from './mappers';
|
|
7
|
-
export declare class TestItFormatter extends Formatter implements IFormatter {
|
|
8
|
-
client: IClient;
|
|
9
|
-
storage: IStorage;
|
|
10
|
-
currentTestCaseId: string | undefined;
|
|
11
|
-
resolvedAutotests: Array<string | undefined> | undefined;
|
|
12
|
-
constructor(options: IFormatterOptions, config: Partial<ClientConfigWithFile>);
|
|
13
|
-
private testRunId;
|
|
14
|
-
private testRunStarted;
|
|
15
|
-
private attachmentsQueue;
|
|
16
|
-
onMeta(_meta: Meta): void;
|
|
17
|
-
onGherkinDocument(document: GherkinDocument): void;
|
|
18
|
-
onPickle(pickle: Pickle): void;
|
|
19
|
-
onTestCase(testCase: TestCase): void;
|
|
20
|
-
onTestCaseStarted(testCaseStarted: TestCaseStarted): void;
|
|
21
|
-
testStepStarted(testStepStarted: TestStepStarted): void;
|
|
22
|
-
onTestStepFinished(testStepFinished: TestStepFinished): void;
|
|
23
|
-
testCaseFinished(testCaseFinished: TestCaseFinished): void;
|
|
24
|
-
onTestRunFinished(_testRunFinished: TestRunFinished): void;
|
|
25
|
-
loadAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
26
|
-
loadPassedAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
27
|
-
createTestRun(): void;
|
|
28
|
-
createNewAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
29
|
-
updateAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
30
|
-
linkWorkItem(externalId: string, workItemId: string): Promise<void>;
|
|
31
|
-
addMessage(message: string): void;
|
|
32
|
-
addLinks(links: LinkPost[]): void;
|
|
33
|
-
addAttachments(attachments: string[]): void;
|
|
34
|
-
private logError;
|
|
35
|
-
}
|
|
1
|
+
import { Formatter, IFormatterOptions } from '@cucumber/cucumber';
|
|
2
|
+
import { GherkinDocument, Pickle, TestCase, TestStepFinished, TestRunFinished, TestCaseStarted, TestCaseFinished, TestStepStarted, Meta } from '@cucumber/messages';
|
|
3
|
+
import { ClientConfigWithFile, IClient, LinkPost } from 'testit-api-client';
|
|
4
|
+
import { IStorage } from './types/storage';
|
|
5
|
+
import { IFormatter } from './types/formatter';
|
|
6
|
+
import { AutotestPostWithWorkItemId } from './mappers';
|
|
7
|
+
export declare class TestItFormatter extends Formatter implements IFormatter {
|
|
8
|
+
client: IClient;
|
|
9
|
+
storage: IStorage;
|
|
10
|
+
currentTestCaseId: string | undefined;
|
|
11
|
+
resolvedAutotests: Array<string | undefined> | undefined;
|
|
12
|
+
constructor(options: IFormatterOptions, config: Partial<ClientConfigWithFile>);
|
|
13
|
+
private testRunId;
|
|
14
|
+
private testRunStarted;
|
|
15
|
+
private attachmentsQueue;
|
|
16
|
+
onMeta(_meta: Meta): void;
|
|
17
|
+
onGherkinDocument(document: GherkinDocument): void;
|
|
18
|
+
onPickle(pickle: Pickle): void;
|
|
19
|
+
onTestCase(testCase: TestCase): void;
|
|
20
|
+
onTestCaseStarted(testCaseStarted: TestCaseStarted): void;
|
|
21
|
+
testStepStarted(testStepStarted: TestStepStarted): void;
|
|
22
|
+
onTestStepFinished(testStepFinished: TestStepFinished): void;
|
|
23
|
+
testCaseFinished(testCaseFinished: TestCaseFinished): void;
|
|
24
|
+
onTestRunFinished(_testRunFinished: TestRunFinished): void;
|
|
25
|
+
loadAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
26
|
+
loadPassedAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
27
|
+
createTestRun(): void;
|
|
28
|
+
createNewAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
29
|
+
updateAutotest(autotestPost: AutotestPostWithWorkItemId): Promise<void>;
|
|
30
|
+
linkWorkItem(externalId: string, workItemId: string): Promise<void>;
|
|
31
|
+
addMessage(message: string): void;
|
|
32
|
+
addLinks(links: LinkPost[]): void;
|
|
33
|
+
addAttachments(attachments: string[]): void;
|
|
34
|
+
private logError;
|
|
35
|
+
}
|