Skip to content

Commit

Permalink
#22 TestRunner based tag analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
anshooarora committed Jan 13, 2025
1 parent e2e0f68 commit 7a1f776
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@ private void updateTagStats(final Test test) {
if (null != test.getTags()) {
addTags(test.getTags());
for (final Tag tag : test.getTags()) {
if (!tagStatsMonitor.containsKey(tag.getName())) {
if (!tagStatsMonitor.containsKey(tag.getName() + test.getDepth())) {
final TagStats ts = new TagStats(test.getDepth());
ts.setName(tag.getName());
tagStats.add(ts);
tagStatsMonitor.put(tag.getName(), ts);
tagStatsMonitor.put(tag.getName() + test.getDepth(), ts);
}
tagStatsMonitor.get(tag.getName() + test.getDepth()).update(test);
for (final Test child : test.getChildren()) {
updateTagStats(child);
}
tagStatsMonitor.get(tag.getName()).update(test);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
<#if build.isBDD()>
<#assign
title1 = 'Features', title2 = 'Scenarios', title3 = 'Steps', tagStatsLevel = 1
>
<#elseif build.testRunner == 'testng'>
<#if build.runStats?size gte 3>
<#assign
title1 = 'Suites', title2 = 'Classes', title3 = 'Methods', tagStatsLevel = 2
>
<#else>
<#assign
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
>
</#if>
<#elseif build.testRunner == 'junit' || build.testRunner == 'junit5' || build.testRunner == 'junit-jupiter'>
<#assign
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
>
<#else>
<#assign
title1 = 'Tests', title2 = 'Methods', title3 = 'Events', tagStatsLevel = 1
>
</#if>
<#if build.runStats?? && build.runStats?has_content && (tagStatsLevel gte build.runStats?size) && build.runStats?size gte 1>
<#assign tagStatsLevel = build.runStats?size - 1>
</#if>

<!DOCTYPE html>
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
Expand Down Expand Up @@ -96,6 +123,7 @@
<td style="" width="60">Skip</td>
</tr>
<#list build.tagStats as tag>
<#if tag.depth == tagStatsLevel>
<tr style="height:10px;"></tr>
<tr>
<td width="350">${tag.name}</td>
Expand All @@ -106,6 +134,7 @@
<td class="padding" width="10"></td>
<td style="" width="60">${tag.skipped}</td>
</tr>
</#if>
</#list>
</table>
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<#if build.isBDD()>
<#assign
title1 = 'Features', title2 = 'Scenarios', title3 = 'Steps'
title1 = 'Features', title2 = 'Scenarios', title3 = 'Steps', tagStatsLevel = 1
>
<#elseif build.testRunner == 'testng'>
<#if build.runStats?size gte 3>
<#assign
title1 = 'Suites', title2 = 'Classes', title3 = 'Methods'
title1 = 'Suites', title2 = 'Classes', title3 = 'Methods', tagStatsLevel = 2
>
<#else>
<#assign
title1 = 'Classes', title2 = 'Methods'
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
>
</#if>
<#elseif build.testRunner == 'junit' || build.testRunner == 'junit-jupiter'>
<#assign
title1 = 'Classes', title2 = 'Methods'
title1 = 'Classes', title2 = 'Methods', tagStatsLevel = 1
>
<#else>
<#assign
title1 = 'Tests', title2 = 'Methods', title3 = 'Events'
title1 = 'Tests', title2 = 'Methods', title3 = 'Events', tagStatsLevel = 1
>
</#if>
<#if build.runStats?? && build.runStats?has_content && (tagStatsLevel gte build.runStats?size) && build.runStats?size gte 1>
<#assign tagStatsLevel = build.runStats?size - 1>
</#if>

<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -188,13 +191,15 @@
</thead>
<tbody>
<#list build.tagStats as tag>
<#if tag.depth == tagStatsLevel>
<tr>
<td><a href="#" class="secondary tag">${tag.name}</a></td>
<td>${tag.total}</td>
<td>${tag.passed}</td>
<td>${tag.failed}</td>
<td>${tag.durationPretty}</td>
</tr>
</#if>
</#list>
</tbody>
</table>
Expand Down

0 comments on commit 7a1f776

Please sign in to comment.