【问题标题】:Maven running testNG suite twiceMaven 运行 testNG 套件两次
【发布时间】:2019-09-25 16:57:33
【问题描述】:

我有一个 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 maven 编译器插件 3.7.0 1.8 1.8 org.apache.maven.plugins maven-surefire-插件 3.0.0-M3 testng.xml testng.xml 从不 --> 错误的

</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>

`

【问题讨论】:

    标签: java maven selenium testng


    【解决方案1】:

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

    【讨论】:

    • 我已经在 pom xml 的 build 部分下方添加了。
    【解决方案2】:

    解决了。我已经包含了 testng.xml 两次。解决了。我已经包含了 testng.xml 两次。还将 testNG 范围设置为在我的 testng xml 中编译

    【讨论】:

    • 你应该接受你的答案,这样问题才会结束。
    【解决方案3】:

    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

    【讨论】:

    • 请修正您答案的格式。
    猜你喜欢
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 1970-01-01
    • 2012-09-15
    • 1970-01-01
    • 2020-08-30
    • 2012-05-10
    • 1970-01-01
    相关资源
    最近更新 更多