in src/runners/testngRunner/TestNGRunnerResultAnalyzer.ts [55:108]
public processData(data: string): void {
const outputData: ITestNGOutputData = JSON.parse(data) as ITestNGOutputData;
this.testContext.testRun.appendOutput(this.unescape(data).replace(/\r?\n/g, '\r\n'));
const id: string = `${this.projectName}@${outputData.attributes.name}`;
if (outputData.name === TEST_START) {
this.initializeCache();
const item: TestItem | undefined = this.getTestItem(id);
if (!item) {
return;
}
this.currentTestState = TestResultState.Running;
this.testContext.testRun.started(item);
} else if (outputData.name === TEST_FAIL) {
const item: TestItem | undefined = this.getTestItem(id);
if (!item) {
return;
}
this.currentTestState = TestResultState.Failed;
const testMessages: TestMessage[] = [];
if (outputData.attributes.trace) {
const markdownTrace: MarkdownString = new MarkdownString();
markdownTrace.isTrusted = true;
markdownTrace.supportHtml = true;
for (const line of outputData.attributes.trace.split(/\r?\n/)) {
this.processStackTrace(line, markdownTrace, undefined, this.currentItem, this.projectName);
}
const testMessage: TestMessage = new TestMessage(markdownTrace);
if (this.testMessageLocation) {
testMessage.location = this.testMessageLocation;
this.testMessageLocation = undefined;
} else if (item.uri && item.range) {
testMessage.location = new Location(item.uri, item.range);
}
testMessages.push(testMessage);
}
const duration: number = Number.parseInt(outputData.attributes.duration, 10);
setTestState(this.testContext.testRun, item, this.currentTestState, testMessages, duration);
} else if (outputData.name === TEST_FINISH) {
const item: TestItem | undefined = this.getTestItem(data);
if (!item) {
return;
}
if (this.currentTestState === TestResultState.Running) {
this.currentTestState = TestResultState.Passed;
}
const duration: number = Number.parseInt(outputData.attributes.duration, 10);
setTestState(this.testContext.testRun, item, this.currentTestState, undefined, duration);
}
}