newman-reporter-qase 1.0.7 → 2.0.0-beta.1

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.
@@ -1,16 +0,0 @@
1
- {
2
- "name": "example",
3
- "version": "1.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "newman run ./sample-collection.json -r qase --reporter-qase-logging --reporter-qase-projectCode project_code --reporter-qase-apiToken api_key --reporter-qase-rootSuiteTitle 'Newman tests' --reporter-qase-runComplete"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "ISC",
12
- "devDependencies": {
13
- "newman": "^5.3.0",
14
- "newman-reporter-qase": "../"
15
- }
16
- }
@@ -1,100 +0,0 @@
1
- {
2
- "info": {
3
- "_postman_id": "549b1242-0882-4fbe-8e6e-aa77b58dceec",
4
- "name": "Example collection",
5
- "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6
- "description": "A sample collection to demonstrate collections as a set of related requests"
7
- },
8
- "item": [
9
- {
10
- "name": "Example folder",
11
- "item": [
12
- {
13
- "name": "A simple GET request with ids",
14
- "event": [
15
- {
16
- "listen": "test",
17
- "script": {
18
- "type": "text/javascript",
19
- "exec": [
20
- "// qase: 222 ",
21
- "pm.test('Status code is 200', function () {",
22
- " pm.response.to.have.status(200);",
23
- "})",
24
- "pm.test('expect response json contain args', function () {",
25
- " pm.expect(pm.response.json().args).to.have.property('source')",
26
- " .and.equal('newman-sample-github-collection')",
27
- "})"
28
- ]
29
- }
30
- }
31
- ],
32
- "request": {
33
- "method": "GET",
34
- "header": [],
35
- "url": {
36
- "raw": "https://postman-echo.com/get?source=newman-sample-github-collection",
37
- "protocol": "https",
38
- "host": [
39
- "postman-echo",
40
- "com"
41
- ],
42
- "path": [
43
- "get"
44
- ],
45
- "query": [
46
- {
47
- "key": "source",
48
- "value": "newman-sample-github-collection"
49
- }
50
- ]
51
- }
52
- },
53
- "response": []
54
- }
55
- ]
56
- },
57
- {
58
- "name": "A simple GET request without ids",
59
- "event": [
60
- {
61
- "listen": "test",
62
- "script": {
63
- "exec": [
64
- "pm.test('Status code is 200', function () {",
65
- " pm.response.to.be.ok;",
66
- "})"
67
- ],
68
- "type": "text/javascript"
69
- }
70
- }
71
- ],
72
- "request": {
73
- "url": "https://postman-echo.com/g",
74
- "method": "GET"
75
- },
76
- "response": []
77
- },
78
- {
79
- "name": "A simple GET request without ids 2",
80
- "event": [
81
- {
82
- "listen": "test",
83
- "script": {
84
- "exec": [
85
- "pm.test('Response time is less than 200ms', function () {",
86
- " pm.expect(pm.response.responseTime).to.be.below(10);",
87
- "})"
88
- ],
89
- "type": "text/javascript"
90
- }
91
- }
92
- ],
93
- "request": {
94
- "url": "https://postman-echo.com/get?source=newman-sample-github-collection",
95
- "method": "GET"
96
- },
97
- "response": []
98
- }
99
- ]
100
- }
@@ -1,151 +0,0 @@
1
- import { describe, expect, it } from '@jest/globals';
2
- import { EventEmitter } from 'events';
3
- import NewmanQaseReporter from '../src';
4
-
5
- describe('Tests', () => {
6
- it('Init main class', () => {
7
- new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
8
- });
9
-
10
- describe('Options', () => {
11
- describe('Support Optional Environmental ID', () => {
12
- it('should set environmental Id to undefined by default', () => {
13
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
14
- expect(reporter['options'].environmentId).toBe(undefined);
15
- });
16
-
17
- it('should set environmental Id by reporter option - environmentalId', () => {
18
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "", environmentId: 5 }, { collection: "" });
19
- expect(reporter['options'].environmentId).toBe(5);
20
- });
21
-
22
- it('should set environmental Id by environmental variable - QASE_ENVIRONMENT_ID', () => {
23
- process.env.QASE_ENVIRONMENT_ID = '6';
24
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
25
- expect(reporter['options'].environmentId).toBe(6);
26
- });
27
- });
28
-
29
- describe('Support Optional Run Complete Option', () => {
30
- it('should have runComplete option false by default', () => {
31
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
32
- expect(reporter['options'].runComplete).toBe(false);
33
- });
34
-
35
- it('should set runComplete from reporter options', () => {
36
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "", runComplete: true }, { collection: "" });
37
- expect(reporter['options'].runComplete).toBe(true);
38
- });
39
-
40
- it('should set runComplete from environmental variable [QASE_RUN_COMPLETE=true]', () => {
41
- process.env.QASE_RUN_COMPLETE = 'true';
42
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
43
- expect(reporter['options'].runComplete).toBe(true);
44
- });
45
- });
46
- });
47
-
48
- describe('Auto Create Defect', () => {
49
- describe('known test cases', () => {
50
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
51
- const tests = [
52
- {
53
- data:
54
- {
55
- name: 'test k1',
56
- result: 'failed',
57
- duration: 1,
58
- ids: [1]
59
- },
60
- defect: true
61
- },
62
- {
63
- data:
64
- {
65
- name: 'test k2',
66
- result: 'passed',
67
- duration: 1,
68
- ids: [2]
69
- },
70
- defect: false
71
- },
72
- {
73
- data:
74
- {
75
- name: 'test k3',
76
- result: 'pending',
77
- duration: 1,
78
- ids: [3]
79
- },
80
- defect: false
81
- }
82
- ];
83
-
84
- tests.forEach(test => {
85
- reporter['prePending'][test.data.name] = test.data as any;
86
- });
87
-
88
- const resultsToPublishData = reporter['createBulkResultsBodyObject']();
89
-
90
- for (const index in tests) {
91
- const test = tests[index];
92
- const status = test.data.result;
93
- const defectValue = test.defect;
94
- it(`should set defect=${defectValue} when status=${status}`, () => {
95
- expect(resultsToPublishData[index].defect).toBe(defectValue);
96
- });
97
- }
98
- });
99
-
100
- describe('unknown test cases', () => {
101
- const reporter = new NewmanQaseReporter(new EventEmitter(), { apiToken: "", projectCode: "" }, { collection: "" });
102
- const tests = [
103
- {
104
- data:
105
- {
106
- name: 'test 1',
107
- result: 'failed',
108
- duration: 1,
109
- ids: []
110
- },
111
- defect: true
112
- },
113
- {
114
- data:
115
- {
116
- name: 'test 2',
117
- result: 'passed',
118
- duration: 1,
119
- ids: []
120
- },
121
- defect: false
122
- },
123
- {
124
- data:
125
- {
126
- name: 'test 3',
127
- result: 'pending',
128
- duration: 1,
129
- ids: []
130
- },
131
- defect: false
132
- }
133
- ];
134
-
135
- tests.forEach(test => {
136
- reporter['prePending'][test.data.name] = test.data as any;
137
- });
138
-
139
- const resultsToPublishData = reporter['createBulkResultsBodyObject']();
140
-
141
- for (const index in tests) {
142
- const test = tests[index];
143
- const status = test.data.result;
144
- const defectValue = test.defect;
145
- it(`should set defect=${defectValue} when status=${status}`, () => {
146
- expect(resultsToPublishData[index].defect).toBe(defectValue);
147
- });
148
- }
149
- });
150
- });
151
- });
File without changes