diff --git a/blueocean-dashboard/src/main/js/components/testing/TestResults.jsx b/blueocean-dashboard/src/main/js/components/testing/TestResults.jsx index 8475c8d4..3c5c26ca 100644 --- a/blueocean-dashboard/src/main/js/components/testing/TestResults.jsx +++ b/blueocean-dashboard/src/main/js/components/testing/TestResults.jsx @@ -32,6 +32,7 @@ const TestCaseResultRow = (props) => { let statusIndicator = null; switch (t.status) { + case 'REGRESSION': case 'FAILED': statusIndicator = StatusIndicator.validResultValues.failure; break; @@ -67,12 +68,11 @@ export default class TestResult extends Component { const suites = this.props.testResults.suites; const tests = [].concat.apply([], suites.map(t => t.cases)); - // possible statuses: PASSED, FAILED, SKIPPED - const failures = tests.filter(t => t.status === 'FAILED'); + // one of 5 possible statuses: PASSED, FIXED, SKIPPED, FAILED, REGRESSION see: hudson.tasks.junit.CaseResult$Status :( const fixed = tests.filter(t => t.status === 'FIXED'); const skipped = tests.filter(t => t.status === 'SKIPPED'); - const newFailures = failures.filter(t => t.age === 1); - const existingFailures = failures.filter(t => t.age > 1); + const newFailures = tests.filter(t => (t.age <= 1 && t.status === 'FAILED') || t.status === 'REGRESSION'); + const existingFailures = tests.filter(t => t.age > 1 && t.status === 'FAILED'); let passBlock = null; let newFailureBlock = null; @@ -129,13 +129,6 @@ export default class TestResult extends Component { ); } - if (fixed.length > 0) { - fixedBlock = (
-

Fixed

- {fixed.map((t, i) => )} -
); - } - if (skipped.length > 0) { skippedBlock = (

Skipped - {skipped.length}

@@ -144,14 +137,22 @@ export default class TestResult extends Component { } } + // always show fixed, whether showing totals or the encouraging message + if (fixed.length > 0) { + fixedBlock = (
+

Fixed

+ {fixed.map((t, i) => )} +
); + } + return (
+ {passBlock} {summaryBlock} {newFailureBlock} {existingFailureBlock} {fixedBlock} {skippedBlock} - {passBlock}
); } diff --git a/blueocean-dashboard/src/test/js/testResult-spec.js b/blueocean-dashboard/src/test/js/testResult-spec.js index 5daf13b4..14560bf1 100644 --- a/blueocean-dashboard/src/test/js/testResult-spec.js +++ b/blueocean-dashboard/src/test/js/testResult-spec.js @@ -62,6 +62,25 @@ describe("TestResults", () => { assert.equal(newFailed, 1); }); + it("Handles REGRESSION case", () => { + var failures = { + "_class":"hudson.tasks.junit.TestResult", + "duration":0.008, "empty":false, "failCount":3, "passCount":0, "skipCount":0, "suites":[ + { "duration":0, "id":null, "name":"failure.TestThisWontFail", "stderr":null, "stdout":null, "timestamp":null, "cases": [ + {"age":5,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest2","skipped":false,"skippedMessage":null,"status":"FAILED","stderr":null,"stdout":null}, + {"age":2,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest3","skipped":false,"skippedMessage":null,"status":"REGRESSION","stderr":null,"stdout":null}, + {"age":1,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest4","skipped":false,"skippedMessage":null,"status":"FAILED","stderr":null,"stdout":null}, + ], + }]}; + + let wrapper = shallow(); + const newFailed = wrapper.find('.new-failure-block h4').text(); + assert.equal(newFailed, 'New failing - 2'); + + const failed = wrapper.find('.existing-failure-block h4').text(); + assert.equal(failed, 'Existing failures - 1'); + }); + it("All passing shown", () => { let wrapper = shallow(); let isDone = wrapper.html().indexOf('done_all') > 0; @@ -78,7 +97,25 @@ describe("TestResults", () => { }]}; wrapper = shallow(); - isDone = wrapper.html().indexOf('done_all') > 0; - assert(isDone, "Done all not found, when should be"); + let html = wrapper.html(); + assert(html.indexOf('done_all') > 0, "Done all not found, when should be"); + assert(html.indexOf('fixed-block') < 0, "No fixed tests!"); + }); + + it("All passing and fixed shown", () => { + var successWithFixed = { + "_class":"hudson.tasks.junit.TestResult", + "duration":0.008, "empty":false, "failCount":0, "passCount":3, "skipCount":0, "suites":[ + { "duration":0, "id":null, "name":"failure.TestThisWontFail", "stderr":null, "stdout":null, "timestamp":null, "cases": [ + {"age":0,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest2","skipped":false,"skippedMessage":null,"status":"FIXED","stderr":null,"stdout":null}, + {"age":0,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest3","skipped":false,"skippedMessage":null,"status":"PASSED","stderr":null,"stdout":null}, + {"age":0,"className":"failure.TestThisWontFail","duration":0,"errorDetails":null,"errorStackTrace":null,"failedSince":0,"name":"aPassingTest4","skipped":false,"skippedMessage":null,"status":"PASSED","stderr":null,"stdout":null}, + ], + }]}; + + let wrapper = shallow(); + let html = wrapper.html(); + assert(html.indexOf('done_all') > 0, "Done all not found, when should be"); + assert(html.indexOf('fixed-block') > 0, "Should have fixed tests!"); }); });