简体   繁体   中英

How to run a test class more than once in a single suite in testng

I have a suite setup in testng for selenium. This suite includes the same test class twice since that class has to be run two times as modifications were made in between. The problem I'm having is testng is only running the first occurrence of the class, and not the second occurrence. Is there a way to get it to run both times in the same suite?

<suite name="P0-SuiteLoopbackGenerateUnsignedItemAgreementToNLC" parallel="false" verbose="10">
    <listeners>
        <listener class-name="com.bpms.tests.MySuiteListener"/>
    </listeners>
    <test name="FirefoxTest">
        <parameter name="browser" value="firefox"/>
        <parameter name="debug" value="true"/>
        <classes>
            <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.LoopbackGenerateUnsignedItemAgreementToNLC"/>
            <class name="com.bpms.tests.DetermineLoopbackToNLC"/>
            <class name="com.bpms.tests.PerformLogisticsAnalysisAfterLoopback"/>
            <class name="com.bpms.tests.SecondReview"/>
            <class name="com.bpms.tests.ReviewNLCDiagrams"/>
            <class name="com.bpms.tests.ConsolidateCountryAuthorizations"/>
            <class name="com.bpms.tests.FinalizeItemInformationAndGenerateUnsignedItemAgreementPDF"/>
            <class name="com.bpms.tests.VerifyAndUploadItemDocuments"/>
        </classes>
    </test>
</suite>

Running this suite results in the second "SecondReview and ReviewNLCDiagrams" being skipped. I need these to run the second time. Is there a way?

The problem is TestNG is designed to not allow duplicate classes in the xml. Taking the suggestions, I had to create new classes (dummy classes) that do nothing more than extend the real class. The solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM