Adding Squad Tags to Extent Reports in a Cucumber-Appium Project ๐Ÿš€

3 min read

Cover Image for 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:

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:

  1. 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.

  2. Extract the Squad Name:

    • Convert the tag to lowercase for consistency.

    • Remove @ and -squad to extract the pure squad name (e.g., automation or energy).

    • Trim any whitespace to ensure clean data.

  3. 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 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. ๐Ÿง‘โ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป