forked from facundoolano/google-play-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
31 lines (26 loc) · 997 Bytes
/
test.js
File metadata and controls
31 lines (26 loc) · 997 Bytes
1
2
3
4
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
import newman from 'newman';
import fs from 'fs';
import path from 'path';
const collectionsPath = './PostmanCollections/';
const collectionData = JSON.parse(fs.readFileSync(path.resolve(collectionsPath + 'GooglePlayAPI.postman_collection.json'), 'utf8'));
const utCollectionData = JSON.parse(fs.readFileSync(path.resolve(collectionsPath + 'GPlayAPIUnitTests.postman_collection.json'), 'utf8'));
const environmentData = JSON.parse(fs.readFileSync(path.resolve(collectionsPath + 'postman_environment.json'), 'utf8'));
const runTests = async () => {
try {
newman.run({
collection: collectionData,
environment: environmentData,
reporters: ['cli', 'htmlextra']
});
newman.run({
collection: utCollectionData,
environment: environmentData,
reporters: ['cli', 'htmlextra']
});
console.log('API tests completed successfully!');
} catch (err) {
console.error('Newman encountered an error:', err);
process.exit(1);
}
};
runTests();