Search code examples
javaseleniumselenium-webdrivertestngqaf

How can I filter testcases using custom meta-data in QAF?


I am using QAF for my automation project. I have project specific meta-data which has group SMOKE, regression, P1 and author with x,y,z name.

SCENARIO: SampleTest
META-DATA: {"description":"Sample Test Scenario","groups":["SMOKE"],"author":["x"]}

    #TODO: call test steps
END

I want to run only "smoke" group and author with "x" or "y". Is there any solution for these?


Solution

  • For example,

     public class TestSelenium {
    
        @Test(groups= "SMOKE")
        public void runSelenium() {
            System.out.println("runSelenium()");
        }
    
        @Test(groups= "Regression")
        public void runSelenium1() {
            System.out.println("runSelenium()1");
        }
    }
    

    Now if you want to execute only "SMOKE" group, do like this way.

    <suite name="TestAll">
    <!-- Run test method on group "selenium" only -->
    <test name="selenium">
    
        <groups>
            <run>
                <include name="SMOKE" />
            </run>
        </groups>
    
         <classes>
            <class name="com.TestSelenium" />
         </classes>
    
       </test>
    
    </suite>
    

    For more details, inclusion/exclusion refer this. http://testng.org/doc/documentation-main.html#exclusions.