+
+DygraphsLocalTester.prototype.run = function() {
+ var executed = false;
+ var start = new Date(). getTime();
+ if (this.tc != null) {
+ if (this.command == 'runAllTests') {
+ console.log('Running all tests for ' + this.tc.name);
+ this.tc.runAllTests();
+ executed = true;
+ } else if (this.command == 'runTest') {
+ console.log('Running test ' + this.tc.name + '.' + this.test);
+ this.tc.runTest(this.test);
+ executed = true;
+ }
+ } else if (this.command == 'runAllTests') {
+ console.log('Running all tests for all test cases');
+ var testCases = getAllTestCases();
+ for (var idx in testCases) {
+ var entry = testCases[idx];
+ var prototype = entry.testCase;
+ this.tc = new entry.testCase();
+ this.tc.runAllTests();
+ }
+ executed = true;
+ }
+
+ var durationms = new Date().getTime() - start;
+
+ if (executed) {
+ this.postResults(this.summary, durationms);
+ } else {
+ this.listTests();
+ }
+}
+
+DygraphsLocalTester.prototype.start_ = function(tc) {
+ this.startms_ = new Date().getTime();
+}
+
+DygraphsLocalTester.prototype.finish_ = function(tc, name, result, e) {
+ var endms_ = new Date().getTime();
+ this.results.push({
+ name : tc.name + '.' + name,
+ result : result,
+ duration : endms_ - this.startms_,
+ e : e
+ });
+ this.summary.passed += result ? 1 : 0;
+ this.summary.failed += result ? 0 : 1;
+}