Using tag filters

Last edited on

Apache Maven is a popular build automation tool for Java Projects. Squish Maven integrations allows to execute Squish GUI Automated Tests as a part of build process. Squish GUI Tester 6.2 offers functionality to tag Test Cases. Our Squish Maven integration allows to execute just those test scripts or BDD secnarios which match a given tag filter settings. This article demonstrated how to assign tags to Test Cases or BDD Scenarios and later on, how to configure Maven project build to run only selected tests.

Adding tags to Test Cases

Tags can be assigned to a Test Case using Squish IDE. In Test Management perspective click on the Test Description tab, then click pencil icon next to tabs. Now, for each Test Case you can provide Summary, Tags and Description.

Squish IDE

Adding tags to BDD Scenarios

Tags can be assigned to Scenario inside a Feature file. Example below shows that tag foo was assigned to Scenario State after adding one entry

Feature: Filling of addressbook
As a user I want to fill the addressbook with entries

Scenario: Initial state of created address book
Given addressbook application is running
When I create a new addressbook
Then addressbook should be empty

@foo
Scenario: State after adding one entry
Given addressbook application is running
When I create a new addressbook
And I add a new person 'John','Doe','john@m.com','500600700' to address book
Then '1' entries should be present

Executing tagged Test Cases on BDD Scenarios in Maven

In order to execute only selected Test Cases you need to use tagFilters tag in POM file. Inside it you can add multiple tags elements. Below are some examples:

<configuration>
   <path>/Applications/SquishForQt6.2-20161221-1222</path>
   <testsuite>/Users/tomasz/git-repo/trainings/suites_py/suite_PageObjects</testsuite>
   <tagFilters>
      <tags>foo</tags>
   </tagFilters>
   <reports>
      <report>
         <format>xml3.1</format>
         <path>/Users/tomasz/maven-squish/addressbook-xml3</path>
      </report>
   </reports>
</configuration>
<configuration>
   <path>/Applications/SquishForQt6.2-20161221-1222</path>
   <testsuite>/Users/tomasz/git-repo/trainings/suites_py/suite_PageObjects</testsuite>
   <tagFilters>
      <tags>foo</tags>
      <tags>bar</tags>
   </tagFilters>
   <reports>
      <report>
         <format>xml3.1</format>
         <path>/Users/tomasz/maven-squish/addressbook-xml3</path>
      </report>
   </reports>
</configuration>
<configuration>
   <path>/Applications/SquishForQt6.2-20161221-1222</path>
   <testsuite>/Users/tomasz/git-repo/trainings/suites_py/suite_PageObjects</testsuite>
   <tagFilters>
      <tags>foo,bar</tags>
   </tagFilters>
   <reports>
      <report>
         <format>xml3.1</format>
         <path>/Users/tomasz/maven-squish/addressbook-xml3</path>
      </report>
   </reports>
</configuration>
<configuration>
   <path>/Applications/SquishForQt6.2-20161221-1222</path>
   <testsuite>/Users/tomasz/git-repo/trainings/suites_py/suite_PageObjects</testsuite>
   <tagFilters>
      <tags>~foo</tags>
   </tagFilters>
   <reports>
      <report>
         <format>xml3.1</format>
         <path>/Users/tomasz/maven-squish/addressbook-xml3</path>
      </report>
   </reports>
</configuration>

Related Information: