Yuvraj
Yuvraj

Reputation: 79

Maven running testNG suite twice

I have a Selenium-Java-TestNG-Maven suite. I am running this through pom xml. But maven is running the tests in testng xml twice. but when I ran the same TestNG xml as testNG suite then it is behaving normally i.e. it is running the tests in TestNG xml only once as expected.

` http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 Auto Auto 0.0.1-SNAPSHOT src src **/*.java maven-compiler-plugin 3.7.0 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin 3.0.0-M3 testng.xml testng.xml never</forkMode> --> false

</build>
<dependencies>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>


    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.11</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>com.relevantcodes</groupId>
        <artifactId>extentreports</artifactId>
        <version>2.41.2</version>
    </dependency>

</dependencies>

`

Upvotes: 0

Views: 414

Answers (3)

user16041877
user16041877

Reputation: 11

I was also facing with maven project - TestNG Framework - Maven Test was running twice  
Reason - In Pom.xml File I have included testng.xml details twice .ex
    Tag1 suitexmlFile     testng.xml  
    Tag2 suitexmlFile     C:\Selenium\lmsmaven\testng.xml
Once you remove one testng.xml details to
Tag1 suitexmlFile     C:\Selenium\lmsmaven\testng.xml
It will work

Upvotes: 0

Yuvraj
Yuvraj

Reputation: 79

Solved it. I had included testng.xml twice. Solved it. I had included testng.xml twice. Also set the testNG scope to Compile in my testng xml

Upvotes: 0

Andrey Miroshnikov
Andrey Miroshnikov

Reputation: 1

show us the section. It may be a cause of the problem

Upvotes: 0

Related Questions