TestNG groups with dependencies specified, not executing in order despite preserve-order set true

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TestNG groups with dependencies specified, not executing in order despite preserve-order set true

abhijeetvaikar

I am using the WebDriver + TestNG + ANT framework. I want to execute a few testng groups in a particular order. I am trying to do that by including dependencies for the groups in testng.xml.

My groups are:
For LoginTests.java
Methods:

  • openLoginPage (groups={"login"}) 
  • validLogin (groups={"login"}) 

For SearchTest.java
Methods:

  • searchValid (groups={"search"}) 

For ScheduleTests.java
Methods:

  • openSchedulingPopupFromSearch (groups={"scheduleBySearch"}) 
  • scheduleBySearch (groups={"scheduleBySearch"} 
  • scheduleByAddingNew (groups={"scheduleByAddNew"}) 

For AddNewTest.java
Methods:

  • clickOnAdd (groups={"addNew"}) 
  • fillInNewDetailsNSubmit (groups={"addNew"}) 
  • validateEnteredInfo (groups={"addNew"})

The order that I want my groups to get executed with is:
1. login
2. search
3. scheduleBySearch
4. addNew
5. scheduleByAddNew

This is the testng.xml file I have created:

<suite name="Sanity Suite" verbose="2" parallel="false">
<test name="Scheduling scenario" preserve-order="true">
    <groups>
        <run>
            <include name="scheduleBySearch" />
            <include name="scheduleByAddNew" />
        </run>
        <dependencies>
            <group name="scheduleBySearch" depends-on="search" />
            <group name="search" depends-on="login" />
            <group name="scheduleByAddNew" depends-on="scheduleBySearch addnew" />
            <group name="addnew" depends-on="login" />
        </dependencies>
    </groups>
    <packages>
        <package name="xtr.webaut.sanitytests.*" />
    </packages>
</test>



I have included preserve-order="true" for the <test></test>. But when I execute this from my build.xml with ANT, the actual order goes like this:
1. login
2. addNew
3. scheduleByAddNew
4. search (This group starts execution in middle when scheduleByAddNew has just started. Don't know why!! And then fails)
5. scheduleBySearch (Skipped) 


When I see the execution logs, I see that TestNG tries to execute addNew & scheduleByAddNewafter login, and suddenly search group starts executing. Is there any possibility of TestNG parallel execution happening here?? Also, if I have specified preserve-order as true then it should run the groups as defined no matter what right? Help needed!!!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.