Adding Squad Tags to Extent Reports in a Cucumber-Appium Project ๐
3 min read
Automation is all about clarity and speed. In projects where multiple squads own different parts of the codebase, organizing test results can feel like herding cats. ๐ฑ๐ฑ But with squad tags, you're turning chaos into order. Here's how we implemented this in our Cucumber-Appium project using the Extent Report adapter for Cucumber.
The Code: Keeping It Clean and Focused ๐งน
Hereโs the snippet we used to automatically extract squad tags and assign them to categories in Extent Reports:
javaCopy codeif (t.toLowerCase().endsWith("-squad")) {
String squadName = t.toLowerCase()
.replace("@", "")
.replace("-squad", "")
.trim();
squads.add(squadName);
((ExtentTest)scenarioThreadLocal.get()).assignCategory(new String[]{t});
}
Letโs break it down:
Identify Squad Tags:
We check if the tag ends with
"-squad"
to filter relevant tags.Tags like
@automation-squad
or@energy-squad
are instantly recognizable as squad-specific.
Extract the Squad Name:
Convert the tag to lowercase for consistency.
Remove
@
and-squad
to extract the pure squad name (e.g.,automation
orenergy
).Trim any whitespace to ensure clean data.
Store and Assign Tags:
Add the squad name to a
squads
list for future use.Assign the full tag (e.g.,
@automation-squad
) to the test category in the Extent Report.
This keeps your reports clean, organized, and aligned with your team structure. ๐ฏ
Why This Approach Rocks ๐
1. Automation at Scale
No need to manually assign tagsโjust add @squad
tags in your feature files, and the code does the rest.
gherkinCopy code@energy-squad
Scenario: Validate energy settings
Given ...
When ...
Then ...
2. Seamless Integration with Extent Reports
Using the Extent Report adapter, the squad tags appear in the reportโs category section, enabling dynamic filtering for each squad.
3. Scalability
Whether you add more squads or reorganize teams, your reports adapt instantly with minimal changes.
Squad Tagging in Action ๐ ๏ธ
Hereโs how the Extent Report looks with squad tagging:
Scenario Categories:
Each test scenario is grouped under its squad tag.Filters:
Want to see tests owned by the Device Squad? Just filter bydevice-squad
.Metrics Per Squad:
Easily analyze pass/fail rates for each squad during retrospectives.
Extending the Functionality ๐
Want to take it further? Here are a few ideas:
Add Execution Time Per Squad:
Track how long each squadโs tests take and identify bottlenecks.Error Trends:
Highlight recurring errors in squad-owned tests to prioritize fixes.Slack Notifications:
Automatically notify squads about failures using their tags.
Final Thoughts ๐ก
Adding squad tagging to Extent Reports is a small but impactful change. It brings clarity, ownership, and faster debugging to your test automation process. If youโre using Cucumber and Appium, this integration is a no-brainer. ๐
Your Turn:
How are you organizing your test results? Have you tried squad tagging yet? Drop your tips and ideas below! ๐ Let's build smarter, together. ๐งโ๐ป๐ฉโ๐ป