【问题标题】:How to rerun testng-failed.xml via maven in the same Jenkins build如何在同一 Jenkins 构建中通过 maven 重新运行 testng-failed.xml
【发布时间】:2015-07-30 02:09:50
【问题描述】:

我是 Maven 和 Jenkins 的新手,不知道如何:

  1. 在同一构建下的 Jenkins 中使用 testng-failed.xml 通过 Maven (pom.xml) 重新运行失败的测试用例。

  2. 使用我的自动化代码,我想运行两个不同的套件,即 smoke.xmlregression.xml 中存在的 Smoke 和 Regression。 我尝试将两个 xml 文件放在 <suiteXmlFiles> 节点下,但这给了我错误。

如果我需要创建单独的 Jenkins 作业来运行烟雾和回归套件,请告诉我。提前致谢。

【问题讨论】:

    标签: maven selenium jenkins selenium-webdriver testng


    【解决方案1】:
    In Pom.xml add two profiles one for regression and other for smoke.Create seperate Jobs in Jenkins for Regression and smoke and configure with corresponding profiles.
    
    Sample Pom.xml profile for regression, do the same for smoke:
    <profile>
                <id>REGRESSION</id>
                <build>
                    <plugins>
    
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <configuration>
                                <argLine>${testng.memory.opts}</argLine>
                                <includes>
                                    <include>${test.include}</include>
                                </includes>
                                <excludes>
                                    <exclude>${test.exclude}</exclude>
                                </excludes>
                                <suiteXmlFiles>
                                    <suiteXmlFile>path/Regression-test.xml</suiteXmlFile>
                                </suiteXmlFiles>
    
                                <systemPropertyVariables>
    
                                </systemPropertyVariables>
                                <properties>
                                    <property>
                                        <name>usedefaultlisteners</name>
                                        <value>false</value>
                                    </property>
                                    <property>
                                        <name>listener</name>
                                        <value>${testng.listeners}</value>
                                    </property>
                                </properties>
                                <!-- <workingDirectory>${project.build.testOutputDirectory}/</workingDirectory> -->
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
                <reporting>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-report-plugin</artifactId>
                            <version>${maven-surefire-report-plugin.version}</version>
                            <configuration>
                                <outputDirectory>${project.build.directory}/${surefire.reports.dir}</outputDirectory>
                            </configuration>
                        </plugin>
                    </plugins>
                </reporting>
            </profile>
    

    【讨论】:

    • 感谢 Nisha 的回复,但是当我将这些更改放在我的 pom.xml 中时,它给了我错误。 maven 中没有可用的“profile”标签;而不是它的'profileS'。此外,当我尝试将 标签放在 下时,它会引发许多错误,例如“无法解析符号 'atrifactid'”、“无法解析符号 'configuration'”等。
    • 请将您的所有个人资料标签放在个人资料标签下:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 2022-07-21
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多