How to have One <test> in testng.xml suite wait for all other <test>s to complete prior to running

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to have One <test> in testng.xml suite wait for all other <test>s to complete prior to running

John Bartels
I currently have the following suite xml file:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >


<suite name="dev_all_parallel" parallel="tests" thread-count="4" configfailurepolicy="continue" >

   <test name="dev_all_bills">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.bills.generation.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>

   <test name="dev_all_private_api" parallel="methods" thread-count="3">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.*.private_api.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>

   <test name="dev_all_local_purchase" parallel="methods" thread-count="1">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.*.local.purchase.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>
</suite>



This is a simplified file in that there are several of the _purchase <test> objects and the thread-count for the suite is higher (9) in my actual file.  The behavior that I want is that the "dev_all_private_api" and "dev_all_local_purchase" <test>s run with their appropriate amount of threads and when both of those <test>s have completed in the <suite>, the "dev_all_bills" test is run.  I had all of this working until I added in my "bills" test (parallelization of my purchase tests brought test execution time down from ~30 minutes to ~6.5 minutes).  The bills test looks at all the line items on a bill whereas the purchase tests affect only one lineItem in the bill.  The two <tests> cannot be run simultaneously because the purchase tests affect the back-end data that is being verified by the "bills" test.  I attempted to use the <dependencies> in the xml file, but this does not appear to work across <test> objects.  I also tried dependsOnGroup and priority annotations without much luck.  Any suggestions/comments would be welcomed.

Regards,

--
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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to have One <test> in testng.xml suite wait for all other <test>s to complete prior to running

Krishnan Mahadevan

I would recommend you pull out your "dev_all_bills" into a separate suite file and put the rest of the tests into a separate suite file. You then create a suite of suites wherein​ you refer to both the suites.

TestNG would run suites in sequence. It will first run your "dev_all_bills" test suite and then move on to run the next suite. That should help you I guess.


On Fri, Mar 31, 2017, 21:25 John Bartels <[hidden email]> wrote:
I currently have the following suite xml file:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >


<suite name="dev_all_parallel" parallel="tests" thread-count="4" configfailurepolicy="continue" >

   <test name="dev_all_bills">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.bills.generation.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>

   <test name="dev_all_private_api" parallel="methods" thread-count="3">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.*.private_api.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>

   <test name="dev_all_local_purchase" parallel="methods" thread-count="1">

       <parameter name="environment" value="dev" />

       <groups>

           <run>

               <include name="billing.*.local.purchase.p1" />

           </run>

       </groups>

       <packages>

           <package name="com.jdb.testing.billingservice.*" />

       </packages>

   </test>
</suite>



This is a simplified file in that there are several of the _purchase <test> objects and the thread-count for the suite is higher (9) in my actual file.  The behavior that I want is that the "dev_all_private_api" and "dev_all_local_purchase" <test>s run with their appropriate amount of threads and when both of those <test>s have completed in the <suite>, the "dev_all_bills" test is run.  I had all of this working until I added in my "bills" test (parallelization of my purchase tests brought test execution time down from ~30 minutes to ~6.5 minutes).  The bills test looks at all the line items on a bill whereas the purchase tests affect only one lineItem in the bill.  The two <tests> cannot be run simultaneously because the purchase tests affect the back-end data that is being verified by the "bills" test.  I attempted to use the <dependencies> in the xml file, but this does not appear to work across <test> objects.  I also tried dependsOnGroup and priority annotations without much luck.  Any suggestions/comments would be welcomed.

Regards,

--
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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...