Skip to main content

Group Tests Using Custom Tags


LambdaTest allows you to group your automation tests using custom tags. In this document, we will see how to create custom tags and use them. For demonstration purposes, we have used a sample TestNG script to run on the LambdaTest platform.

How To Create Custom Tags While Performing Automation On LambdaTest Selenium Grid?


You can create a custom tag using a simple step. While writing your Selenium automation tests, when you create the Desired Capabilities via code, just add the below lines of code.

  • Create a String array that contains the names of your custom tags, separated by a comma.
        // In case for just 1 tag, just add 1 element in the array
String[] customTags = {"Custom Tag"};

// In case for multiple tags, add them in the array separated by comma
String[] customTags = {"Tag 1", "Tag 2", "Tag 3", ...};
  • Now you just need to add this custom tag in your Desired Capabilities instance, as shown below:
        DesiredCapabilities caps = new DesiredCapabilities();
.
.

// To create custom tags
caps.setCapability("tags", customTags);

For example:

custom tags

You have successfully created the custom tags. Let's now see how to view the custom tags and how to group the test based on custom tags in the below section.

How To View Custom Tags On LambdaTest Platform?


There are multiple ways by which you can view the custom tags in the automation dashboard, such as Timeline view and Automation logs view. We will see one by one, how to view the custom tags in each of these.

How To View Custom Tags On Your Timeline?

Navigate to Timeline view of your automation dashboard, and toggle the Build View to Test View, as shown in the image below:

Automation build

You can see the applied custom tags below the tests in this Test View. Test View

How To View Custom Tags On Your Automation Logs?


Navigate to Automation Logs of your automation dashboard, and you can see the applied custom tags below the tests in the left panel. Automation logs

How To Filter Tests Using Custom Tags On LambdaTest Platform?


You can also filter the tests on your automation dashboard with the help of these custom tags. Let us see how.

Navigate to Automation Logs of your automation dashboard, and you can see a filter by name Tags in the filter toolbar. Automation tags

Click on it and select the Tag by which you want to filter the tests on your dashboard. For example, we have filtered the test using Tag2 custom tag, as shown in the image below:

automation log tags

You can even filter the tests by selecting multiple custom tags at once, from the filter toolbar, as shown in the image below:

custom automation tags

Kudos! You have successfully created a custom tag and grouped your tests based on the custom tag. If you still have any questions, feel free to share them with us through our 24/7 chat support or by mailing to us on support@lambdatest.com. Happy testing! :)