Adding Squad Tags to Extent Reports in a Cucumber-Appium Project
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:
if (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-squador@energy-squadare instantly recognizable as squad-specific.
- We check if the tag ends with
-
Extract the Squad Name:
- Convert the tag to lowercase for consistency.
- Remove
@and-squadto extract the pure squad name (e.g.,automationorenergy). - Trim any whitespace to ensure clean data.
-
Store and Assign Tags:
- Add the squad name to a
squadslist for future use. - Assign the full tag (e.g.,
@automation-squad) to the test category in the Extent Report.
- Add the squad name to a
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.
@energy-squadScenario: 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 by
device-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.