0

I am developing a TestNG automation framework using Java language and Eclipse Neon IDE with latest webdriver and testng versions. I am using webdriver 3.9.1 version and TestNG 6.14.3 version. I have a master testng.xml file which contains multiple suite files, created each for the independent classes added to the project for individual modules of AUT.

It can be the case that all or few of the suite files, within the master suite file, be executed as per the requirement. Each file should be executed only once. The login suite file will always be executed and then followed by the required test modules. The issue is that the last suite file in the master testng.xml file runs twice. Below are the xml file snippets for reference:

Master testng.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="allSuites" thread-count="5" verbose="1" allow-return-values="false" parallel="false" data-provider-thread-count="10" junit="false" configfailurepolicy="skip" skipfailedinvocationcounts="false">
<!-- <suite guice-stage="DEVELOPMENT" name="All" verbose="1"> -->

<suite-files>
    <suite-file path="./TestNG_ClassXMLs/LoginTest.xml" />  
    <suite-file path="./TestNG_ClassXMLs/ProfileTest.xml" /> 
</suite-files>
</suite>    <!-- Default suite -->

ProfileText.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Identities-IMSI" thread-count="5" verbose="1" allow-return-values="false" parallel="false" data-provider-thread-count="10" junit="false" configfailurepolicy="skip" skipfailedinvocationcounts="false">
<!--  <suite name="Suite" parallel="false">-->
 <!-- <test name="Test">
    <classes>
      <class name="GUIScreens_Tests.IMSI_Test"/>
    </classes>
  </test>  Test -->

<test verbose="2" name="AddProfile">
    <classes>
        <class name="TestCases.Profile_Test" >
            <methods>
                <include name="testProfile" />
                <include name="addProfile" /> 
                <include name="delProfile" />
                <!-- <include name="exportDataAsCSV" /> 
                <include name="dualWriteVerification" />-->
            </methods>
        </class> 
        <parameter name="TestCaseID" value="Profile_Add_TC001"/>
        <parameter name="TestData File Path" value="/TestData/dataFile.xlsx"/>
        <parameter name="SheetName" value="Profiles"/>
        <parameter name="TestDescription" value="Add a new profile."/>
    </classes>
</test>

</suite> <!-- Suite -->

Login.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="LoginTest" thread-count="5" verbose="1" allow-return-values="false" parallel="false" data-provider-thread-count="10" junit="false" configfailurepolicy="skip" skipfailedinvocationcounts="false">

<test  thread-count="5" verbose="2" name="Login">
    <classes>
        <class name="TestCases.Login_Test">
            <!-- <methods>
                <include name="testLogin" />
            </methods>-->
        </class> 
        <parameter name="TestCaseID" value="Login_TC001" />
        <parameter name="TestData File Path" value="/TestData/dataFile.xlsx" />
        <parameter name="SheetName" value="Login" />
        <parameter name="TestDescription" value="Login Success" />
    </classes>
</test>

</suite>
ShrutiM
  • 1
  • 2
  • Can you please retry using the latest released version of TestNG viz. `6.14.3` and post back your findings ? – Krishnan Mahadevan May 11 '18 at 03:02
  • @Krishnan, thanks for suggestion. However, i am using latest webdriver and testng versions. I am using webdriver 3.9.1 version and TestNG 6.14.3 version. Updated the same in above question. Thanks – ShrutiM May 11 '18 at 10:04
  • Can you create a simple trimmed down version of your code and post it here (let's skip webdriver etc and keep it to just a bunch of print statements) – Krishnan Mahadevan May 11 '18 at 14:57
  • With whatever you have posted so far, its hard to even comment as to where something could be wrong. So I would suggest that you first start off by creating samples that can be used to reproduce the problem and post that sample by editing your quesiton. – Krishnan Mahadevan May 14 '18 at 07:19
  • @Krishnan, thanks for reverting. Actually the AUT is not publicly accessible so even on providing code base would not have helped and I am actually not getting what portion of code you are asking for. However, the issue is resolved. Actually the thing was that I was calling the function within main class and also listed separately in TestNG suite as independent test so it was getting executed twice. – ShrutiM May 15 '18 at 11:34
  • In that case, you might want to post your answer to your question and accept it as well, so that your question gets closed off. – Krishnan Mahadevan May 15 '18 at 11:59
  • Thanks Krishnan, however, its human error so I believe the answer is not worth, however, I welcome your suggestions!! – ShrutiM May 15 '18 at 15:00

0 Answers0