-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
64 lines (56 loc) · 1.42 KB
/
index.js
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
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
const rootPrefix = '.',
configProvider = require(rootPrefix + '/lib/configProvider'),
StartSuite = require(rootPrefix + '/lib/Suite/Start'),
StartSecurityTest = require(rootPrefix + '/lib/Suite/StartSecurityTest'),
SchemaValidator = require(rootPrefix + '/lib/schema/Validate');
/**
* Class exposed by this package
*
* @class ApiTestSuite
*/
class ApiTestSuite {
constructor(openapiObj, serverIndex, securityInfo) {
const oThis = this;
oThis.openapiObj = openapiObj;
oThis.serverIndex = serverIndex;
oThis.securityInfo = securityInfo;
// Saving the params in-memory via configProvider
configProvider.setConfig('openapiObj', oThis.openapiObj);
configProvider.setConfig('serverIndex', oThis.serverIndex);
configProvider.setConfig('securityInfo', oThis.securityInfo);
}
/**
* Start the suite to run test cases
*
* @return {Promise<void>}
*/
runTest() {
new StartSuite().perform();
}
/**
* Start the suite to run test for security params
*
* @return {Promise<void>}
*/
runSecurityTest() {
new StartSecurityTest().perform();
}
/**
* Cleanup the in-memory saved config
*
* @return {Promise<void>}
*/
cleanup() {
configProvider.deleteConfig();
}
/**
* Schema Validator to validate data vs dataSchema
*
* @returns {*}
* @constructor
*/
get SchemaValidator() {
return SchemaValidator;
}
}
module.exports = ApiTestSuite;