how to run testng groups in order without relying strictly on dependency

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

how to run testng groups in order without relying strictly on dependency

I am trying to run grouped TestNG tests. The given xml is a test in testng.xml:

<test name="demo test" preserve-order="true">
           <include name="openlogin"/>
           <include name="login"/>
           <include name="searchPatient"/>
           <include name="scheduleBySearch" />
           <include name="openDashboardFromPatientToday"/>
           <include name="openPatientChart"/>
           <include name="referralSearch"/>
           <include name="referralNotes"/>
           <include name="removeReferral"/>
           <include name="nonExistingReferralSearch"/>

            <group name="removeReferral" depends-on="referralNotes"/>
            <group name="referralNotes" depends-on="referralSearch"/>
            <group name="referralSearch" depends-on="openPatientChart"/>
            <group name="openPatientChart" depends-on="openDashboardFromPatientToday"/>
            <group name="openDashboardFromPatientToday" depends-on="scheduleBySearch"/>
            <group name="scheduleBySearch" depends-on="searchPatient" />
            <group name="searchPatient" depends-on="login" />
            <group name="login" depends-on="openlogin"/>

         <class name="xtr.webaut.sanitytests.LoginTests"/>
         <class name="xtr.webaut.sanitytests.PatientSearchTest"/>
         <class name="xtr.webaut.sanitytests.PatientScheduleTests"/>
         <class name="xtr.webaut.sanitytests.PatientTodayTests"/>
         <class name="xtr.webaut.sanitytests.PatientDashboardViewTests"/>
         <class name="xtr.webaut.sanitytests.PatientChartReferralTests"/>
Here there is a group "nonExistingReferralSearch" that I don't want to be dependent upon any other group. But I want it to be executed in the specified order and I have set "preserve-order" as true for the<test>. While execution, I find that TestNG does not execute the non-dependent group in order. It executes that group immediately after the group "openlogin" whereas I am expecting it to get executed in the end. 

Is it wrong to define dependencies as well as tell TestNG to maintain an order of execution? Is there an unknown priority defined that TestNG will execute any non-dependent tests/groups first and then the dependent tests? I hope it is not that inflexible.

Even for a generic scenario in a <test>, is it not possible to run some test methods/groups without any dependency and some test methods/groups with dependencies, in an order? 
I have read about IMethodInterceptor but it doesn't seem to be useful for ordering groups. Can someone please help? I am stuck and cannot move ahead without solving this issue.

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
For more options, visit