Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

Tsvetomir Slavov
How to re-run failed TestNG tests with mvn. I use the following to run my build: mvn clean install
Thank you in advance!

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.tsvetomir</groupId>
<artifactId>rocketchatpom</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Dependency versions -->
<selenium.version>3.5.3</selenium.version>
<!-- Configurable variables -->
<threads>1</threads>
<browser>firefox</browser>
<overwrite.binaries>false</overwrite.binaries>
<seleniumGridURL/>
<platform/>
<browserVersion/>
</properties>

<profiles>
<profile>
<id>selenium</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<parallel>methods</parallel>
<threadCount>${threads}</threadCount>
<systemProperties>
<browser>${browser}</browser>
<screenshotDirectory>${project.build.directory}/screenshots</screenshotDirectory>
<remoteDriver>${remote}</remoteDriver>
<gridURL>${seleniumGridURL}</gridURL>
<desiredPlatform>${platform}</desiredPlatform>

<desiredBrowserVersion>${browserVersion}</desiredBrowserVersion> <!--Set properties passed in by the driver binary downloader-->
<!--Set properties passed in by the driver binary downloader-->
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
<webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
<webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
</systemProperties>
<includes>
<!-- All that is left now is to clean up the code in our basicTest class and change its name to BasicTestWD. You may have noticed that we added an <includes> configuration item to our POM. This is because Maven will use maven-surefireplugin to run files that have test at the start or end of their name. We don't want maven-surefire-plugin to pick up our tests; we want to use maven-failsafeplugin instead. -->
<include>**/*WD.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.7</version>
<configuration>
<rootStandaloneServerDirectory>
${project.basedir}/src/test/resources/selenium_standalone_binaries
</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>${project.basedir}/src/test/resources/selenium_standalone_zips
</downloadedZipFileDirectory>
<customRepositoryMap>${project.basedir}/src/test/resources/RepositoryMap.xml
</customRepositoryMap>
<overwriteFilesThatExist>${overwrite.binaries}</overwriteFilesThatExist>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


<dependencies>
<!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.4.3</version>
</dependency>

</dependencies>

</profile>
</profiles>

</project>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

⇜Krishnan Mahadevan⇝

Use the suiteXmlFiles attribute of the plugin where you pass the reference of a suite xml file.

 

Read more : http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#suiteXmlFiles

 

Whenever you want to re-run, just pass in the testng-failed.xml file as a reference to the suite file.

But make sure you don’t use the clean goal, else the target folder will be cleaned up and you wont have a reference to the testng-failed.xml

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Tsvetomir Slavov <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, October 7, 2017 at 11:52 PM
To: testng-users <[hidden email]>
Subject: [testng-users] Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

 

How to re-run failed TestNG tests with mvn. I use the following to run my build: mvn clean install

Thank you in advance!

 

<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
        
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>
4.0.0</modelVersion>

    <groupId>
com.tsvetomir</groupId>
    <artifactId>
rocketchatpom</artifactId>
    <version>
1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>
UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>
UTF-8</project.reporting.outputEncoding>
       
<!-- Dependency versions -->
       
<selenium.version>3.5.3</selenium.version>
       
<!-- Configurable variables -->
       
<threads>1</threads>
        <browser>
firefox</browser>
        <overwrite.binaries>
false</overwrite.binaries>
        <seleniumGridURL/>
        <platform/>
        <browserVersion/>
    </properties>

    <profiles>
        <profile>
            <id>
selenium</id>
            <activation>
                <activeByDefault>
true</activeByDefault>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>
1.8</source>
                            <target>
1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-failsafe-plugin</artifactId>
                        <version>
2.17</version>
                        <configuration>
                            <parallel>
methods</parallel>
                            <threadCount>
${threads}</threadCount>
                            <systemProperties>
                                <browser>
${browser}</browser>
                                <screenshotDirectory>
${project.build.directory}/screenshots</screenshotDirectory>
                                <remoteDriver>
${remote}</remoteDriver>
                                <gridURL>
${seleniumGridURL}</gridURL>
                                <desiredPlatform>
${platform}</desiredPlatform>

                                <desiredBrowserVersion>
${browserVersion}</desiredBrowserVersion>             <!--Set properties passed in by the driver binary              downloader-->
                                <!--Set properties passed in by the driver binary downloader-->
                               
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
                                <webdriver.chrome.driver>
${webdriver.chrome.driver}</webdriver.chrome.driver>
                                <webdriver.ie.driver>
${webdriver.ie.driver}</webdriver.ie.driver>
                                <webdriver.opera.driver>
${webdriver.opera.driver}</webdriver.opera.driver>
                            </systemProperties>
                            <includes>
                               
<!-- All that is left now is to clean up the code in our basicTest class and change its name to BasicTestWD. You may have noticed that we added an <includes> configuration item to our POM. This is because Maven will use maven-surefireplugin to run files that have test at the start or end of their name. We don't want maven-surefire-plugin to pick up our tests; we want to use maven-failsafeplugin instead. -->
                               
<include>**/*WD.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
integration-test</goal>
                                    <goal>
verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>
com.lazerycode.selenium</groupId>
                        <artifactId>
driver-binary-downloader-maven-plugin</artifactId>
                        <version>
1.0.7</version>
                        <configuration>
                            <rootStandaloneServerDirectory>
                               
${project.basedir}/src/test/resources/selenium_standalone_binaries
                           
</rootStandaloneServerDirectory>
                            <downloadedZipFileDirectory>
${project.basedir}/src/test/resources/selenium_standalone_zips
                           
</downloadedZipFileDirectory>
                            <customRepositoryMap>
${project.basedir}/src/test/resources/RepositoryMap.xml
                           
</customRepositoryMap>
                            <overwriteFilesThatExist>
${overwrite.binaries}</overwriteFilesThatExist>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
selenium</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>


            <dependencies>
               
<!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest -->
               
<dependency>
                    <groupId>
org.hamcrest</groupId>
                    <artifactId>
java-hamcrest</artifactId>
                    <version>
2.0.0.0</version>
                    <scope>
test</scope>
                </dependency>


                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-java</artifactId>
                    <version>
${selenium.version}</version>
                    <scope>
test</scope>
                </dependency>
                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-remote-driver</artifactId>
                    <version>
${selenium.version}</version>
                </dependency>
                <dependency>
                    <groupId>
org.testng</groupId>
                    <artifactId>
testng</artifactId>
                    <version>
6.9.4</version>
                    <scope>
test</scope>
                </dependency>
               
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
               
<dependency>
                    <groupId>
com.codeborne</groupId>
                    <artifactId>
phantomjsdriver</artifactId>
                    <version>
1.4.3</version>
                </dependency>

            </dependencies>

        </profile>
    </profiles>

</project>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

Tsvetomir Slavov
Is there an automatic way to do this? Like a post build action in Jenkins to run only the failed tests? Because right now this is not possible to be automated.

On Saturday, October 7, 2017 at 10:57:24 PM UTC-5, Krishnan Mahadevan wrote:

Use the suiteXmlFiles attribute of the plugin where you pass the reference of a suite xml file.

 

Read more : <a href="http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#suiteXmlFiles" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2Fsurefire%2Fmaven-failsafe-plugin%2Fintegration-test-mojo.html%23suiteXmlFiles\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEegS8kzd2H819kcj7iu6xcIVBE2w&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2Fsurefire%2Fmaven-failsafe-plugin%2Fintegration-test-mojo.html%23suiteXmlFiles\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEegS8kzd2H819kcj7iu6xcIVBE2w&#39;;return true;">http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#suiteXmlFiles

 

Whenever you want to re-run, just pass in the testng-failed.xml file as a reference to the suite file.

But make sure you don’t use the clean goal, else the target folder will be cleaned up and you wont have a reference to the testng-failed.xml

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...> on behalf of Tsvetomir Slavov <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ccee...@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Date: Saturday, October 7, 2017 at 11:52 PM
To: testng-users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Subject: [testng-users] Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

 

How to re-run failed TestNG tests with mvn. I use the following to run my build: mvn clean install

Thank you in advance!

 

<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="<a href="http://maven.apache.org/POM/4.0.0" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHniHazh___yjkHSI3PBdhuZVHNgw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHniHazh___yjkHSI3PBdhuZVHNgw&#39;;return true;">http://maven.apache.org/POM/4.0.0"
        
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFERp6A_kcvqihMCKJ7EHX8O14vIA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFERp6A_kcvqihMCKJ7EHX8O14vIA&#39;;return true;">http://www.w3.org/2001/XMLSchema-instance"
        
xsi:schemaLocation="<a href="http://maven.apache.org/POM/4.0.0" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHniHazh___yjkHSI3PBdhuZVHNgw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHniHazh___yjkHSI3PBdhuZVHNgw&#39;;return true;">http://maven.apache.org/POM/4.0.0 <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFooKp_ndR1_GzTUBHrZ7dw50YoEw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFooKp_ndR1_GzTUBHrZ7dw50YoEw&#39;;return true;">http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>
4.0.0</modelVersion>

    <groupId>
com.tsvetomir</groupId>
    <artifactId>
rocketchatpom</artifactId>
    <version>
1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>
UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>
UTF-8</project.reporting.outputEncoding>
       
<!-- Dependency versions -->
       
<selenium.version>3.5.3</selenium.version>
       
<!-- Configurable variables -->
       
<threads>1</threads>
        <browser>
firefox</browser>
        <overwrite.binaries>
false</overwrite.binaries>
        <seleniumGridURL/>
        <platform/>
        <browserVersion/>
    </properties>

    <profiles>
        <profile>
            <id>
selenium</id>
            <activation>
                <activeByDefault>
true</activeByDefault>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>
1.8</source>
                            <target>
1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-failsafe-plugin</artifactId>
                        <version>
2.17</version>
                        <configuration>
                            <parallel>
methods</parallel>
                            <threadCount>
${threads}</threadCount>
                            <systemProperties>
                                <browser>
${browser}</browser>
                                <screenshotDirectory>
${project.build.directory}/screenshots</screenshotDirectory>
                                <remoteDriver>
${remote}</remoteDriver>
                                <gridURL>
${seleniumGridURL}</gridURL>
                                <desiredPlatform>
${platform}</desiredPlatform>

                                <desiredBrowserVersion>
${browserVersion}</desiredBrowserVersion>             <!--Set properties passed in by the driver binary              downloader-->
                                <!--Set properties passed in by the driver binary downloader-->
                               
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
                                <webdriver.chrome.driver>
${webdriver.chrome.driver}</webdriver.chrome.driver>
                                <webdriver.ie.driver>
${webdriver.ie.driver}</webdriver.ie.driver>
                                <webdriver.opera.driver>
${webdriver.opera.driver}</webdriver.opera.driver>
                            </systemProperties>
                            <includes>
                               
<!-- All that is left now is to clean up the code in our basicTest class and change its name to BasicTestWD. You may have noticed that we added an <includes> configuration item to our POM. This is because Maven will use maven-surefireplugin to run files that have test at the start or end of their name. We don't want maven-surefire-plugin to pick up our tests; we want to use maven-failsafeplugin instead. -->
                               
<include>**/*WD.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
integration-test</goal>
                                    <goal>
verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>
com.lazerycode.selenium</groupId>
                        <artifactId>
driver-binary-downloader-maven-plugin</artifactId>
                        <version>
1.0.7</version>
                        <configuration>
                            <rootStandaloneServerDirectory>
                               
${project.basedir}/src/test/resources/selenium_standalone_binaries
                           
</rootStandaloneServerDirectory>
                            <downloadedZipFileDirectory>
${project.basedir}/src/test/resources/selenium_standalone_zips
                           
</downloadedZipFileDirectory>
                            <customRepositoryMap>
${project.basedir}/src/test/resources/RepositoryMap.xml
                           
</customRepositoryMap>
                            <overwriteFilesThatExist>
${overwrite.binaries}</overwriteFilesThatExist>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
selenium</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>


            <dependencies>
               
<!-- <a href="https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmvnrepository.com%2Fartifact%2Forg.hamcrest%2Fjava-hamcrest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHCeK2NSAnHv1MQ5XY3cWCjMEFNIA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmvnrepository.com%2Fartifact%2Forg.hamcrest%2Fjava-hamcrest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHCeK2NSAnHv1MQ5XY3cWCjMEFNIA&#39;;return true;">https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest -->
               
<dependency>
                    <groupId>
org.hamcrest</groupId>
                    <artifactId>
java-hamcrest</artifactId>
                    <version>
2.0.0.0</version>
                    <scope>
test</scope>
                </dependency>


                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-java</artifactId>
                    <version>
${selenium.version}</version>
                    <scope>
test</scope>
                </dependency>
                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-remote-driver</artifactId>
                    <version>
${selenium.version}</version>
                </dependency>
                <dependency>
                    <groupId>
org.testng</groupId>
                    <artifactId>
testng</artifactId>
                    <version>
6.9.4</version>
                    <scope>
test</scope>
                </dependency>
               
<!-- <a href="https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmvnrepository.com%2Fartifact%2Fcom.codeborne%2Fphantomjsdriver\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDd67cOddvQoaf6LNexYrJ2yrv7Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmvnrepository.com%2Fartifact%2Fcom.codeborne%2Fphantomjsdriver\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDd67cOddvQoaf6LNexYrJ2yrv7Q&#39;;return true;">https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
               
<dependency>
                    <groupId>
com.codeborne</groupId>
                    <artifactId>
phantomjsdriver</artifactId>
                    <version>
1.4.3</version>
                </dependency>

            </dependencies>

        </profile>
    </profiles>

</project>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="hqvx4sjYAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

⇜Krishnan Mahadevan⇝

Just have your post build step check for the existence of testng-failed.xml file and if it exists, have it trigger the tests.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Tsvetomir Slavov <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, October 9, 2017 at 8:54 PM
To: testng-users <[hidden email]>
Subject: Re: [testng-users] Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

 

Is there an automatic way to do this? Like a post build action in Jenkins to run only the failed tests? Because right now this is not possible to be automated.

On Saturday, October 7, 2017 at 10:57:24 PM UTC-5, Krishnan Mahadevan wrote:

Use the suiteXmlFiles attribute of the plugin where you pass the reference of a suite xml file.

 

Read more : http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#suiteXmlFiles

 

Whenever you want to re-run, just pass in the testng-failed.xml file as a reference to the suite file.

But make sure you don’t use the clean goal, else the target folder will be cleaned up and you wont have a reference to the testng-failed.xml

 

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <<a href="javascript:" target="_blank">testng...@...> on behalf of Tsvetomir Slavov <<a href="javascript:" target="_blank">ccee...@...>
Reply-To: <<a href="javascript:" target="_blank">testng...@...>
Date: Saturday, October 7, 2017 at 11:52 PM
To: testng-users <<a href="javascript:" target="_blank">testng...@...>
Subject: [testng-users] Maven-failsafe-plugin how to re-run failed TestNG test? Surefire has a default re-run property for JUnit 4, but not for TestNG.

 

How to re-run failed TestNG tests with mvn. I use the following to run my build: mvn clean install

Thank you in advance!

 

<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
        
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>
4.0.0</modelVersion>

    <groupId>
com.tsvetomir</groupId>
    <artifactId>
rocketchatpom</artifactId>
    <version>
1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>
UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>
UTF-8</project.reporting.outputEncoding>
       
<!-- Dependency versions -->
       
<selenium.version>3.5.3</selenium.version>
       
<!-- Configurable variables -->
       
<threads>1</threads>
        <browser>
firefox</browser>
        <overwrite.binaries>
false</overwrite.binaries>
        <seleniumGridURL/>
        <platform/>
        <browserVersion/>
    </properties>

    <profiles>
        <profile>
            <id>
selenium</id>
            <activation>
                <activeByDefault>
true</activeByDefault>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>
1.8</source>
                            <target>
1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>
org.apache.maven.plugins</groupId>
                        <artifactId>
maven-failsafe-plugin</artifactId>
                        <version>
2.17</version>
                        <configuration>
                            <parallel>
methods</parallel>
                            <threadCount>
${threads}</threadCount>
                            <systemProperties>
                                <browser>
${browser}</browser>
                                <screenshotDirectory>
${project.build.directory}/screenshots</screenshotDirectory>
                                <remoteDriver>
${remote}</remoteDriver>
                                <gridURL>
${seleniumGridURL}</gridURL>
                                <desiredPlatform>
${platform}</desiredPlatform>

                                <desiredBrowserVersion>
${browserVersion}</desiredBrowserVersion>             <!--Set properties passed in by the driver binary              downloader-->
                                <!--Set properties passed in by the driver binary downloader-->
                               
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
                                <webdriver.chrome.driver>
${webdriver.chrome.driver}</webdriver.chrome.driver>
                                <webdriver.ie.driver>
${webdriver.ie.driver}</webdriver.ie.driver>
                                <webdriver.opera.driver>
${webdriver.opera.driver}</webdriver.opera.driver>
                            </systemProperties>
                            <includes>
                               
<!-- All that is left now is to clean up the code in our basicTest class and change its name to BasicTestWD. You may have noticed that we added an <includes> configuration item to our POM. This is because Maven will use maven-surefireplugin to run files that have test at the start or end of their name. We don't want maven-surefire-plugin to pick up our tests; we want to use maven-failsafeplugin instead. -->
                               
<include>**/*WD.java</include>
                            </includes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
integration-test</goal>
                                    <goal>
verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>
com.lazerycode.selenium</groupId>
                        <artifactId>
driver-binary-downloader-maven-plugin</artifactId>
                        <version>
1.0.7</version>
                        <configuration>
                            <rootStandaloneServerDirectory>
                               
${project.basedir}/src/test/resources/selenium_standalone_binaries
                           
</rootStandaloneServerDirectory>
                            <downloadedZipFileDirectory>
${project.basedir}/src/test/resources/selenium_standalone_zips
                           
</downloadedZipFileDirectory>
                            <customRepositoryMap>
${project.basedir}/src/test/resources/RepositoryMap.xml
                           
</customRepositoryMap>
                            <overwriteFilesThatExist>
${overwrite.binaries}</overwriteFilesThatExist>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
selenium</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>


            <dependencies>
               
<!-- https://mvnrepository.com/artifact/org.hamcrest/java-hamcrest -->
               
<dependency>
                    <groupId>
org.hamcrest</groupId>
                    <artifactId>
java-hamcrest</artifactId>
                    <version>
2.0.0.0</version>
                    <scope>
test</scope>
                </dependency>


                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-java</artifactId>
                    <version>
${selenium.version}</version>
                    <scope>
test</scope>
                </dependency>
                <dependency>
                    <groupId>
org.seleniumhq.selenium</groupId>
                    <artifactId>
selenium-remote-driver</artifactId>
                    <version>
${selenium.version}</version>
                </dependency>
                <dependency>
                    <groupId>
org.testng</groupId>
                    <artifactId>
testng</artifactId>
                    <version>
6.9.4</version>
                    <scope>
test</scope>
                </dependency>
               
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
               
<dependency>
                    <groupId>
com.codeborne</groupId>
                    <artifactId>
phantomjsdriver</artifactId>
                    <version>
1.4.3</version>
                </dependency>

            </dependencies>

        </profile>
    </profiles>

</project>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank">testng-users...@....
To post to this group, send email to <a href="javascript:" target="_blank">testng...@....
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.