0

I am not able to run my test suite in correct flow as it was running earlier in version 6.9.9. It was working fine with 6.9.9 But above or equal 6.11 it's not working same as before.

Here is my sample code of java file.

public class TestReport {



    @Test(groups= {"t1"})
    @Parameters("gauravS")
    public static void test2(@Optional String g) {

        System.out.println("helloooooooo t1");

    }

    @Test( groups= {"t2"})
    public static void test1() {

              System.out.println("failing case t2");

        assertTrue(true);
    }






}

Here is my testng.xml

<?xml version="1.0" encoding="UTF-8"?>

<suite name="Suite">
  <test  name="123">
  <groups>
    <run  >
    <include name="t1" />
    <include name="t2" />
    </run>

         <dependencies>
                <group name="t2" depends-on="t1" />
        </dependencies>

  </groups>
    <classes>
      <class name="tests.logging.TestReport"/>
    </classes>
  </test> <!-- Test -->


</suite> <!-- Suite -->

Here is my Pom.xml

<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">
    <!-- Prepared by Aakash and Gaurav -->
    <modelVersion>4.0.0</modelVersion>

    <groupId>SampleProject</groupId>
    <artifactId>SampleProject</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>SampleProject</name>
    <url>http://maven.apache.org</url>

    <properties>
        <gaurav>1234</gaurav>
        <browserName>chrome</browserName>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    </properties>

    <!-- Build dependency -->

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- Appache poi dependency -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
        <!-- Depency of mysql connector jar -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.6</version>
        </dependency>
    <!-- Depency of mssql connector jar -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.1.0.jre8</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- Selenium server jar dependency -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.13.0</version>
        </dependency>
        <!-- java mail api -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>1.5.6</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.0</version>
        </dependency>
        <!-- Report NG dependency -->
        <dependency>
            <groupId>org.uncommons</groupId>
            <artifactId>reportng</artifactId>
            <version>1.1.4</version>
            <scope>test</scope>
        </dependency>

        <!-- Apache commoms math lib -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.2</version>
        </dependency>



        <!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>4.0</version>
        </dependency>


        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.13.1</version>

        </dependency>



        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
        </dependency>


        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-email</artifactId>
            <version>1.4</version>
        </dependency>

    </dependencies>
    <build>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>


                <configuration>
                <systemPropertyVariables>
                   <!--  <environment>${BUILD_URL}</environment> -->
                </systemPropertyVariables>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>

            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>

                    <fork>true</fork>
                </configuration>
            </plugin>

        </plugins>

    </build>
</project>
<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">
    <!-- Prepared by Aakash and Gaurav -->
    <modelVersion>4.0.0</modelVersion>

    <groupId>SampleProject</groupId>
    <artifactId>SampleProject</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>SampleProject</name>
    <url>http://maven.apache.org</url>

    <properties>
        <gaurav>1234</gaurav>
        <browserName>chrome</browserName>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    </properties>

    <!-- Build dependency -->

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- Appache poi dependency -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
        <!-- Depency of mysql connector jar -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.6</version>
        </dependency>
    <!-- Depency of mssql connector jar -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.1.0.jre8</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- Selenium server jar dependency -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.13.0</version>
        </dependency>
        <!-- java mail api -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>1.5.6</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.0</version>
        </dependency>
        <!-- Report NG dependency -->
        <dependency>
            <groupId>org.uncommons</groupId>
            <artifactId>reportng</artifactId>
            <version>1.1.4</version>
            <scope>test</scope>
        </dependency>

        <!-- Apache commoms math lib -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.2</version>
        </dependency>



        <!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>4.0</version>
        </dependency>


        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.13.1</version>

        </dependency>



        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
        </dependency>


        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>3.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-email</artifactId>
            <version>1.4</version>
        </dependency>

    </dependencies>
    <build>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>


                <configuration>
                <systemPropertyVariables>
                   <!--  <environment>${BUILD_URL}</environment> -->
                </systemPropertyVariables>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>

            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>

                    <fork>true</fork>
                </configuration>
            </plugin>

        </plugins>

    </build>
</project>

Now as per the TestNg xml i should have output helloooooooo t1 failing case t2

But i am getting viseversa

and it was woring fine TestNg version 6.9.9

TestNg selenium

  • Please retry using TestNG `7.0.0-beta1` (latest released version) and see if the problem goes away. If the problem persists, please create a new bug with a simple standalone test that can be used to reproduce the issue and file it in the TestNG project. – Krishnan Mahadevan Oct 26 '18 at 03:45
  • Thanks @KrishnanMahadevan i have updated testNG to latest beta version and surefire plugin and it seems like working fine for now. – Gaurav kumar Oct 26 '18 at 04:30
  • @KrishnanMahadevan I have update my testng but Now i am not able to run my existing case by xml from eclipse.Getting an error – Gaurav kumar Oct 26 '18 at 06:46
  • There are some backward compatibility breaking changes between TestNG 6 and TestNG 7 series. So if you would like to use TestNG 7.0.0-beta1 you would also need to use the latest version of TestNG eclipse plugin. – Krishnan Mahadevan Oct 26 '18 at 09:11
  • @KrishnanMahadevan thanks again. – Gaurav kumar Oct 29 '18 at 11:07

0 Answers0