mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Show the test results in a TextView at the end of the test run.
This commit is contained in:
@ -1,11 +1,12 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
import TKUnit = require("./TKUnit");
|
import * as TKUnit from"./TKUnit";
|
||||||
import trace = require("trace");
|
import {messageType} from "trace";
|
||||||
import frameModule = require("ui/frame");
|
import {topmost, Frame} from "ui/frame";
|
||||||
import platform = require("platform");
|
import {TextView} from "ui/text-view";
|
||||||
import uiTestModule = require("./ui-test");
|
import * as platform from "platform";
|
||||||
|
import "./ui-test";
|
||||||
|
|
||||||
frameModule.Frame.defaultAnimatedNavigation = false;
|
Frame.defaultAnimatedNavigation = false;
|
||||||
|
|
||||||
export function isRunningOnEmulator(): boolean {
|
export function isRunningOnEmulator(): boolean {
|
||||||
// This checks are not good enough to be added to modules but keeps unittests green.
|
// This checks are not good enough to be added to modules but keeps unittests green.
|
||||||
@ -123,22 +124,29 @@ function printRunTestStats() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TKUnit.write("=== ALL TESTS COMPLETE === " + (testsCount - failedTestCount) + " OK, " + failedTestCount + " failed", trace.messageType.info);
|
let finalMessage = "=== ALL TESTS COMPLETE === \n" + (testsCount - failedTestCount) + " OK, " + failedTestCount + " failed" + "\n";
|
||||||
|
TKUnit.write(finalMessage, messageType.info);
|
||||||
for (j = 0; j < failedTestInfo.length; j++) {
|
for (j = 0; j < failedTestInfo.length; j++) {
|
||||||
TKUnit.write(failedTestInfo[j], trace.messageType.error);
|
let failureMessage = failedTestInfo[j];
|
||||||
|
TKUnit.write(failureMessage, messageType.error);
|
||||||
|
finalMessage += "\n" + failureMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let messageContainer = new TextView();
|
||||||
|
messageContainer.text = finalMessage;
|
||||||
|
topmost().currentPage.content = messageContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function startLog(): void {
|
function startLog(): void {
|
||||||
let testsName: string = this.name;
|
let testsName: string = this.name;
|
||||||
TKUnit.write("START " + testsName + " TESTS.", trace.messageType.info);
|
TKUnit.write("START " + testsName + " TESTS.", messageType.info);
|
||||||
this.start = TKUnit.time();
|
this.start = TKUnit.time();
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(): void {
|
function log(): void {
|
||||||
let testsName: string = this.name;
|
let testsName: string = this.name;
|
||||||
let duration = TKUnit.time() - this.start;
|
let duration = TKUnit.time() - this.start;
|
||||||
TKUnit.write(testsName + " COMPLETED for " + duration, trace.messageType.info);
|
TKUnit.write(testsName + " COMPLETED for " + duration, messageType.info);
|
||||||
}
|
}
|
||||||
|
|
||||||
export var runAll = function (moduleName?: string) {
|
export var runAll = function (moduleName?: string) {
|
||||||
|
Reference in New Issue
Block a user