Skip to content

Commit

Permalink
EPMRPP-87239 exclude skipped tests from statistics (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
grabsefx authored Jan 30, 2024
1 parent 0a2a427 commit 5ac2052
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ List<TopPatternTemplatesContent> patternTemplate(Filter filter, Sort sort,
*/
List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilter, Sort launchSort,
boolean isLatest, int launchesLimit,
Filter testItemFilter, String currentLevelKey);
Filter testItemFilter, String currentLevelKey, boolean excludeSkipped);

/**
* Generate a materialized view for cumulative trend chart widget.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ public List<TopPatternTemplatesContent> patternTemplate(Filter filter, Sort sort
@Override
public List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilter,
Sort launchSort, boolean isLatest, int launchesLimit,
Filter testItemFilter, String currentLevelKey) {
Filter testItemFilter, String currentLevelKey, boolean excludeSkipped) {

Table<? extends Record> launchesTable = QueryUtils.createQueryBuilderWithLatestLaunchesOption(
launchFilter, launchSort, isLatest)
Expand Down Expand Up @@ -1094,8 +1094,8 @@ public List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilte
.on((TEST_ITEM.ITEM_ID.eq(ITEM_ATTRIBUTE.ITEM_ID)
.or(TEST_ITEM.LAUNCH_ID.eq(ITEM_ATTRIBUTE.LAUNCH_ID))).and(
ITEM_ATTRIBUTE.KEY.eq(currentLevelKey).and(ITEM_ATTRIBUTE.SYSTEM.isFalse())))
.groupBy(TEST_ITEM.ITEM_ID, TEST_ITEM_RESULTS.STATUS, ITEM_ATTRIBUTE.KEY,
ITEM_ATTRIBUTE.VALUE)
.groupBy(TEST_ITEM.ITEM_ID, TEST_ITEM_RESULTS.STATUS, ITEM_ATTRIBUTE.KEY, ITEM_ATTRIBUTE.VALUE)
.having(filterSkippedTests(excludeSkipped))
.asTable(ITEMS))
.groupBy(fieldName(ITEMS, VALUE))
.orderBy(DSL.round(DSL.val(PERCENTAGE_MULTIPLIER)
Expand All @@ -1106,6 +1106,19 @@ public List<ComponentHealthCheckContent> componentHealthCheck(Filter launchFilte
.fetch());
}

private Condition filterSkippedTests(boolean excludeSkipped) {
Condition condition = DSL.noCondition();
if (excludeSkipped) {
return DSL.notExists(
dsl.selectOne().from(STATISTICS).join(STATISTICS_FIELD)
.on(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
.where(TEST_ITEM.ITEM_ID.eq(STATISTICS.ITEM_ID)
.and(STATISTICS.STATISTICS_FIELD_ID.eq(STATISTICS_FIELD.SF_ID))
.and(STATISTICS_FIELD.NAME.eq(EXECUTIONS_SKIPPED))));
}
return condition;
}

@Override
public void generateCumulativeTrendChartView(boolean refresh, String viewName,
Filter launchFilter, Sort launchesSort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,8 @@ void componentHealthCheck() {
false,
600,
itemsFilter,
"new"
"new",
false
);

assertTrue(contents.isEmpty());
Expand Down

0 comments on commit 5ac2052

Please sign in to comment.