Skip to content

Commit

Permalink
handled null output and made constants for common strings in the code,
Browse files Browse the repository at this point in the history
…Fixes #894, signed-off-by: Hajer Dahmani hdahmani@andrew.cmu.edu

Signed-off-by: Hajer Dahmani <hdahmani@andrew.cmu.edu>
  • Loading branch information
Hajer Dahmani committed Jul 22, 2024
1 parent 6463dfc commit 8dcd0a5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions TestResultSummaryService/parsers/Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ const regexFinishTime = /(.*?) Finish Time\: .* Epoch Time \(ms\)\: (\d+).*/;
const regexStartTime = /(.*?) Start Time\: .* Epoch Time \(ms\)\: (\d+).*/;
const TestBenchmarkParser = require(`./TestBenchmarkParser`);
const ExternalTestParser = require(`./ExternalTestParser`);
const preTest = 'Pre Test';
const postTest = 'Post Test';
const testPassed = 'PASSED';
const testFailed = 'FAILED';

const Utils = require(`./Utils`);

Expand All @@ -26,9 +30,9 @@ class Test extends Parser {
return {
tests: [
{
testName: 'Pre Test',
testName: preTest,
testOutput: '',
testResult: 'FAILED',
testResult: testFailed,
testData: null
}
],
Expand All @@ -53,8 +57,6 @@ class Test extends Parser {
}

async extract(str) {
const preTest = 'Pre Test';
const postTest = 'Post Test';
let m,
testStr,
testName,
Expand Down Expand Up @@ -89,7 +91,7 @@ class Test extends Parser {
results.push({
testName: preTest,
testOutput: nonTestStr,
testResult: 'PASSED',
testResult: testPassed,
testData: null,
});
nonTestStr = '';
Expand Down Expand Up @@ -141,7 +143,7 @@ class Test extends Parser {
results.push({
testName,
testOutput: testStr,
testResult: 'FAILED',
testResult: testFailed,
testData: null,
startTime,
});
Expand All @@ -150,7 +152,7 @@ class Test extends Parser {
results.push({
testName: preTest,
testOutput: str,
testResult: 'FAILED',
testResult: testFailed,
testData: null,
});
} else if (!postTestDone) {
Expand All @@ -160,8 +162,8 @@ class Test extends Parser {
testResult: nonTestStr.match(
/Finished: (SUCCESS|UNSTABLE|ABORTED)/
)
? 'PASSED'
: 'FAILED',
? testPassed
: testFailed,
testData: null,
});
}
Expand Down

0 comments on commit 8dcd0a5

Please sign in to comment.