Skip to content

Commit

Permalink
7902691: AllTests-kind of HTML report should be careful with tests th…
Browse files Browse the repository at this point in the history
…at were filtered during the last test run
  • Loading branch information
dbessono committed Jun 5, 2020
1 parent 475d6c4 commit f42a37e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/com/sun/javatest/report/ReportSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

package com.sun.javatest.report;

import com.sun.javatest.AllTestsFilter;
import com.sun.javatest.Harness;
import com.sun.javatest.InitialUrlFilter;
import com.sun.javatest.InterviewParameters;
Expand Down Expand Up @@ -531,7 +532,7 @@ void setupSortedResults() {
}
// additionally appending filtered tests to the list of NOT_RUN
// specifying rejection reason as their Status message
getFilterStats().entrySet().forEach(
getFilterStatsIfReportIsNotForAllTests().entrySet().forEach(
e -> e.getValue().forEach(
td -> sortedTestResults.get(Status.NOT_RUN).add(
new TestResult(td, new Status(Status.NOT_RUN, e.getKey().getReason()))
Expand All @@ -543,10 +544,13 @@ void setupSortedResults() {
/**
* @return filters that rejected tests mapped to test descriptions of the rejected
*/
Map<TestFilter, ArrayList<TestDescription>> getFilterStats() {
Map<TestFilter, ArrayList<TestDescription>> getFilterStatsIfReportIsNotForAllTests() {
Harness harness = getInterview().getTestSuite().getHarness();
// it might be that no test run was done, so the harness was not inited
if (harness != null) {
// also if the report is for "All Tests" filter
// then not giving filtering stats from the last run
// since if might corrupt the overall stats calculation
if ( harness != null && !(filter instanceof AllTestsFilter) ) {
return harness.getTestIterator().getFilterStats();
} else {
return Collections.emptyMap();
Expand Down
2 changes: 1 addition & 1 deletion src/com/sun/javatest/report/StatisticsSection.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class StatisticsSection extends HTMLSection {
}
}
// additionally processing keywords of the filtered tests
settings.getFilterStats().entrySet().forEach(
settings.getFilterStatsIfReportIsNotForAllTests().entrySet().forEach(
e -> e.getValue().forEach(td -> processKeywords(Status.NOT_RUN, td)));

}
Expand Down

0 comments on commit f42a37e

Please sign in to comment.