-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunTests.gs
36 lines (31 loc) · 934 Bytes
/
RunTests.gs
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
function RunTests(className, testName) {
if (!Test) {
Utility.Logger.log('No Tests were ran because Test is undefined');
}
Utility.Logger.log('TEST RUNS:');
for (var testClass in Test) {
Utility.Logger.log('');
Utility.Logger.log('Class: ' + testClass);
if (className) {
if (testClass !== className) {
continue;
}
}
for (var singleTest in Test[testClass]) {
if (testName) {
if (singleTest !== testName) {
continue;
}
}
if (!Test[testClass].hasOwnProperty(singleTest)) {
continue;
}
// if it is a function and it starts with the word test, we want to run it
if (typeof Test[testClass][singleTest] === 'function' && singleTest.indexOf('test') === 0) {
Test[testClass][singleTest]();
Utility.Logger.log(singleTest + ' PASSED!');
}
}
}
Utility.Logger.log('Finished test runs');
};