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 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
- ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/master/images/banner.png)
3
-
4
- ## Getting Started
5
-
6
- ### Compatibility
7
-
8
- | Test IT | Adapter |
9
- |---------|---------|
10
- | 3.5 | 1.0 |
11
- | 4.0 | 1.1 |
12
-
13
- ### Installation
14
- ```
15
- npm install testit-adapter-cucumber
16
- ```
17
-
18
- ## Usage
19
-
20
- ### API client
21
-
22
- To use adapter you need to install `testit-api-client`:
23
- ```
24
- npm install testit-api-client
25
- ```
26
-
27
- ### Configuration
28
-
29
- Create `testitFormatter.js` file in the root directory of the project:
30
- ```js
31
- const { TestItFormatter } = require('testit-adapter-cucumber');
32
-
33
- module.exports = class CustomFormatter extends TestItFormatter {
34
- constructor(options) {
35
- super(options, {
36
- url: '<url>',
37
- privateToken: '<token>',
38
- projectId: '<id>',
39
- configurationId: '<id>',
40
- testRunId: '<optional id>',
41
- });
42
- }
43
- };
44
- ```
45
-
46
- And fill object with your configuration. Formatter sends results to Test IT.
47
-
48
- > TestRunId is optional. If it's not provided than it create automatically.
49
-
50
- Add to `cucumber.js` file
51
-
52
- ```js
53
- module.exports = {
54
- default:
55
- '-f ./testitFormatter.js',
56
- };
57
- ```
58
-
59
- ### Tags
60
-
61
- Formatter provides additional methods to World:
62
-
63
- - addMessage - adds message to autotest
64
- - addLinks - adds links to autotest
65
- - addAttachments - uploads specified to Test IT and links to test run
66
-
67
- ```js
68
- When('Something happens', function () {
69
- this.addMessage('💔');
70
- this.addLinks([
71
- {
72
- url: 'http://github.com',
73
- },
74
- {
75
- url: 'https://wikipedia.org',
76
- title: 'Wikipedia',
77
- description: 'The free encyclopedia',
78
- type: 'Related',
79
- hasInfo: true,
80
- },
81
- ]);
82
- this.addAttachments(['path/to/file.txt']);
83
- });
84
- ```
85
-
86
- Cucumber tags can be used to specify information about autotest.
87
-
88
- > Only those specified above the `Scenario` are taken into account
89
-
90
- - `@ExternalId` - Unique identifier of autotest (Required)
91
- - `@Title` - Title that is displayed on autotest page
92
- - `@DisplayName` - Name that is displayed in autotests table
93
- - `@Description` - Autotest description
94
- - `@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`)
95
- - `@Label` - Label that is going to be linked to autotest
96
- - `@WorkItemId` - Work item's ID to which autotest is going to be linked
97
-
98
- ### Examples
99
-
100
- #### Tags
101
- ```
102
- Feature: Tags
103
- @DisplayName=GoogiliGoogle
104
- @Description=Cannot_Write_With_Spaces
105
- @ExternalId=344
106
- @Link=http://google.com
107
- @Link=http://vk.com
108
- @Label=Maths
109
- @Label=School
110
- Scenario: Scenario with links
111
- When 2+2
112
- Then Result is 4
113
- @Title=LINKS
114
- @ExternalId=343
115
- @Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}
116
- Scenario: Scenario with link obj
117
- When 2+2
118
- Then Result is 4
119
- ```
120
-
121
- #### Parameterized test
122
- ```
123
- Feature: Rule
124
- Tests that use Rule
125
- @ExternalId=999
126
- Scenario: Summing
127
- When <left>+<right>
128
- Then Result is <result>
129
-
130
- Examples: Options
131
- Examples show different options
132
- | left | right | result |
133
- | 1 | 1 | 3 |
134
- | 9 | 9 | 18 |
135
- ```
136
-
137
- # Contributing
138
-
139
- You can help to develop the project. Any contributions are **greatly appreciated**.
140
-
141
- * 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.
142
- * Please make sure you check your spelling and grammar.
143
- * Create individual PR for each suggestion.
144
- * 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.
145
-
146
- # License
147
-
148
- Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.
149
-
1
+ # Test IT TMS adapters for Cucumber
2
+ ![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/master/images/banner.png)
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
+
@@ -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
+ }