Home > Enterprise >  Testng run scenario in paralel
Testng run scenario in paralel

Time:12-15

I am trying to execute multiple classes i have in my project the problem i am having is when i run my testng.xml file it open three navigator one for each class and runs the first one after it finishes closes that nav and goes to the next one rince and repeat.

What i want her to do is to open nav for the first class after it finishes it should close that nav open a new one for the next class and keep on doing this.

From what i understood is that i missed thread-count but even after i added it it still doesn't work

My testNg.xml file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
    <listeners>
    <listener class-name="c.CustomListener"/>
    <listener class-name="z.CustomListener"/>
    </listeners>
  <test name="Test cz" thread-count="8">
    <classes>
      <class name="c.y"/>
      <class name="c.x"/>
      <class name="z.e"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

CodePudding user response:

Set parallel by classes. <test name="Test cz" parallel="classes" thread-count="8">

Also move the code for launch/quit browser to beforeClass/afterClass.

CodePudding user response:

The solution i found is this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
    <listeners>
    <listener class-name="c.CustomListener"/>
    <listener class-name="z.CustomListener"/>
    </listeners>
  <test name="Test ze">
    <classes>
      <class name="z.e"/>
    </classes>
  </test> <!-- Test -->
<test name="Test cx">
    <classes>
      <class name="c.x"/>
    </classes>
  </test> <!-- Test -->
<test name="Test cy">
    <classes>
      <class name="c.y"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->
  • Related