id | title | hide_title | sidebar_label | description | keywords | url | site_name | slug | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
group-tests-using-custom-tags |
How To Create Custom Automation Tags |
true |
Group Tests Using Custom Tags |
Now group your tests and organize them efficiently with the help of Custom Tags. LambdaTest allows you to create custom tags and filter them with a click. |
|
LambdaTest |
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.
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:
<img loading="lazy" src={require('../assets/images/uploads/custom-tags-5-1.webp').default} alt="custom tags" width="1089" height="708" className="doc_img"/>
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.
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.
Navigate to Timeline view of your automation dashboard, and toggle the Build View to Test View, as shown in the image below:
<img loading="lazy" src={require('../assets/images/uploads/build-view.webp').default} alt="Automation build" width="1024" height="414" className="doc_img"/>
You can see the applied custom tags below the tests in this Test View. <img loading="lazy" src={require('../assets/images/uploads/test-view.webp').default} alt="Test View" width="1024" height="461" className="doc_img"/>
Navigate to Automation Logs of your automation dashboard, and you can see the applied custom tags below the tests in the left panel. <img loading="lazy" src={require('../assets/images/uploads/tags-1.webp').default} alt="Automation logs" width="1024" height="407" className="doc_img"/>
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. <img loading="lazy" src={require('../assets/images/uploads/tags-2.webp').default} alt="Automation tags" width="1024" height="399" className="doc_img"/>
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:
<img loading="lazy" src={require('../assets/images/uploads/tags-3.webp').default} alt="automation log tags" width="1838" height="790" className="doc_img"/>
You can even filter the tests by selecting multiple custom tags at once, from the filter toolbar, as shown in the image below:
<img loading="lazy" src={require('../assets/images/uploads/custom-tags-13.webp').default} alt="custom automation tags" width="1024" height="429" className="doc_img"/>
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 <span className="doc__lt" onClick={() => window.openLTChatWidget()}>24/7 chat support or by mailing to us on support@lambdatest.com. Happy testing! :)