Maven 运行 testNG 套件两次



我有一个Selenium-Java-TestNG-Maven套件。我正在通过pom xml运行这个。但是 maven 在 testng xml 中运行了两次测试。但是当我运行与testNG套件相同的TestNG xml时,它的行为正常,即它只按预期在TestNG xml中运行一次测试。

' http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0 自动 自动 0.0.1-快照 来源 来源 **/*。.java 专家编译器插件 3.7.0 1.8 1.8 org.apache.maven.plugins Maven-surefire-plugin 3.0.0-M3 测试.xml 测试.xml 从不 -->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>

'

向我们展示该部分。这可能是问题的原因

解决了。我包括测试.xml两次。解决了。我包括测试.xml两次。还要在我的testng xml中将testNG范围设置为编译

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:Seleniumlmsmaventestng.xml
Once you remove one testng.xml details to
Tag1 suitexmlFile     C:Seleniumlmsmaventestng.xml
It will work

最新更新