Run entire suite multiple times

1,568 views
Skip to first unread message

Greg Martz

unread,
Nov 7, 2014, 1:36:43 PM11/7/14
to testng...@googlegroups.com
Good morning,

I want to run my suite multiple times.  Let's say 100 times...  I used to be able to do it in Junit4 just by surrounding the classes by a for next loop.  Can't seem to do that with TestNg.  Any ideas with examples?  Here is my suite xml.  

NOTE:  I do NOT want to run each class 100 times, I want to run all classes, one after each other.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SuiteEndToEnd" parallel="false" verbose="10" thread-count="2">
    <listeners>
        <listener class-name="com.bpms.tests.MySuiteListener"/>
    </listeners>
   <test name="FirefoxTests">
    <parameter name="browser" value="firefox"/>
    <classes>
     <class name="com.bpms.tests.InitiateBuyPlan"/>
          <class name="com.bpms.tests.AddItemsToBuyPlan"/>
          <class name="com.bpms.tests.ReviewBuyPlan"/>
          <class name="com.bpms.tests.ApproveBuyPlan"/>
          <class name="com.bpms.tests.ManageQuoteSolicitation"/>
          <class name="com.bpms.tests.StartQuote"/>
          <class name="com.bpms.tests.ReviewQuote"/>
          <class name="com.bpms.tests.RecordInterestInQuotes"/>
          <class name="com.bpms.tests.ReviewCountryBuyIn"/>
          <class name="com.bpms.tests.CompleteItemInfo"/>
          <class name="com.bpms.tests.ReviewItemInformation"/>
          <class name="com.bpms.tests.UpdateInterestInQuote"/>
          <class name="com.bpms.tests.PerformLogisticsAnalysis"/>
          <class name="com.bpms.tests.SecondReview"/>
          <class name="com.bpms.tests.ReviewNLCDiagrams"/>
          <class name="com.bpms.tests.ConfirmItemSpecifications"/>
          <class name="com.bpms.tests.ClassifyItem"/>
          <class name="com.bpms.tests.ApproveItem" />
          <class name="com.bpms.tests.ClassifyItem2"/>
          <class name="com.bpms.tests.CompleteItemClassification"/>
          <class name="com.bpms.tests.ApproveItemClassification"/>
          <class name="com.bpms.tests.SubmitLinkToFreightEstimates"/>
          <class name="com.bpms.tests.ReviewFreightWorksheet"/>
          <class name="com.bpms.tests.ReviewItemInfoAndReviseInterest"/>
          <class name="com.bpms.tests.ManageAnalyzedQuotes"/>
          <class name="com.bpms.tests.AuthorizeItemDevelopment"/>
          <class name="com.bpms.tests.ConsolidateCountryAuthorizations"/>
          <class name="com.bpms.tests.FinalizeItemInformationAndGenerateUnsignedItemAgreementPDF"/>
          <class name="com.bpms.tests.VerifyAndUploadItemDocuments"/>
          <class name="com.bpms.tests.AttachDocsForApproval"/>
          <class name="com.bpms.tests.FinalizeItemForApproval"/>
          <class name="com.bpms.tests.ApproveItemGMM"/>
          <class name="com.bpms.tests.ConsolidateInCountryAGMM_GMMResponses"/>
          <class name="com.bpms.tests.InitiateCodeOfConductForFactory"/>
          <class name="com.bpms.tests.SubmitAuditResultsForFactory"/>
          <class name="com.bpms.tests.ConfirmItemSetupAndPOsIssued"/>
          <class name="com.bpms.tests.VerifyReceiptsOfPOs"/>
          <class name="com.bpms.tests.ConfirmReceiptOfPOs"/>
          <class name="com.bpms.tests.ReviewQAProductionTestResults"/>
          <class name="com.bpms.tests.CompleteProjectChecklist"/>
          <class name="com.bpms.tests.VerifySupplierCodeOfConductForFactory"/>
          <class name="com.bpms.tests.VerifyChainSecurityForFactory"/>
          <class name="com.bpms.tests.HandleHighRiskSupplier"/>
  </classes>
    </test>
</suite>


Thanks!
Greg

Krishnan Mahadevan

unread,
Nov 11, 2014, 8:32:37 PM11/11/14
to testng...@googlegroups.com

Greg
I don't think you can do this without resorting to using the TestNG APIs.

So you would need to programmatically create a TestNG instance, pass in the suite Xml location and perhaps try calling the run () method "n" number of times.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Hubert Grzeskowiak

unread,
Nov 12, 2014, 10:34:20 AM11/12/14
to testng...@googlegroups.com
There are multiple possibilities.

1. Create a new suite file where you include the other suite 100 times like this:
<suite-files>
<suite-file path="./junit-suite.xml" />
<suite-file path="./junit-suite.xml" />
<suite-file path="./junit-suite.xml" />
...
</suite-files>

2. Run the suite in a loop using ANT/Maven.

3. Run the suite in a loop on the command line (might become a CLASSPATH mess).

4. Use a continuous integration server like Jenkins and set up the loop there.

Cheers
Hubert Grzeskowiak

Hubert Grzeskowiak

unread,
Nov 12, 2014, 10:35:40 AM11/12/14
to testng...@googlegroups.com
Addition to option 1: that suite should be very easy to generate. You shouldn't copy'paste the line 100x.
Reply all
Reply to author
Forward
0 new messages