-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestHelper.ts
37 lines (31 loc) · 967 Bytes
/
TestHelper.ts
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
const nconf = require("nconf");
export class TestOptions {
owner = "";
}
export class TestHelper {
static _instance: TestHelper;
_jobId: string;
_owner: string;
constructor() {
// Load command line arguments, environment variables and config.json into nconf
nconf.argv().env();
this._jobId = nconf.get("JobId");
}
// Common setup code that runs before each is executed
static async commonTestSetup() {
TestHelper._instance = new TestHelper();
}
// Common cleanup code after the test is done executing
static async commonTestCleanup() {
// For instance,
// Collect test telemetry and upload it to server
}
/**
* Configure test context with the custom options set by test
* @param options Test options
*/
static async init(options) {
TestHelper._instance = new TestHelper();
TestHelper._instance._owner = options.owner;
}
}