Running TestNG QAF BDD tests in Parallel

567 views Asked by At

How do I run all Qmerty tests in a folder in parallel using TestNG, I have my config XML like below, but tests in resources/scenarios/smoketests folder are not running in parallel

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite"  thread-count="5" verbose="1" parallel="tests">
    <listeners>
        <listener class-name="com.mycompany.project.BDD.listeners.BDDListener"></listener>
    </listeners>
    <test name="All Smoke Tests">
        <parameter name="scenario.file.loc" value="resources/scenarios/smoketests" />
        <parameter name="step.provider.pkg" value="com.mycompany.project.BDD" />
        <classes>
            <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
        </classes>
    </test>
</suite>

but below XML runs tests in parallel, but I dont want to keep adding tests in this file every time my team adds a new test

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite"  thread-count="5" verbose="1">
<listeners>
    <listener class-name="com.mycompany.project.BDD.listeners.BDDListener"></listener>
</listeners>
<test name="Smoke-Test-1">
    <parameter name="scenario.file.loc" value="resources/scenarios/smoketests/login.feature" />
    <parameter name="step.provider.pkg" value="com.mycompany.project.BDD" />
    <classes>
        <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
    </classes>
</test>
<test name="Smoke-Test-2">
    <parameter name="scenario.file.loc" value="resources/bdd/scenarios/smoketests/logout.feature" />
    <parameter name="step.provider.pkg" value="com.mycompany.project.BDD" />
    <classes>
        <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
    </classes>
</test>
</suite>

Thanks in advance.

1

There are 1 answers

1
user861594 On BEST ANSWER

From the configuration file you provided in question: In #1 you need to use parallel="methods" instead of parallel="tests" or add parallel="methods" in test node.

For example:

<suite name="Suite"  thread-count="5" verbose="1" parallel="methods">
   <test name="Smoke-Test-1">

Or

<suite name="Suite"  thread-count="5" verbose="1">
   <test name="Smoke-Test-1" parallel="methods">

In #2 you have provided thread-count="1" that's why it will not able to make available multiple threads for parallel execution!