Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 667
bangoria anjali Avatar asked Oct 29 '22 18:10

bangoria anjali


2 Answers

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.

like image 120
Anjali Sahu Avatar answered Nov 15 '22 06:11

Anjali Sahu


You can use include or exclude properties refer documentation here. For example:

include= {'author': ['x']}

to run all scenario with author value x. you can provide this properties in any property file or as system property or in run configuration xml file refer different ways of providing prop.

like image 32
user861594 Avatar answered Nov 15 '22 04:11

user861594