1

I am having 2 feature files and i want to execute parallely through testng. If i execute mvn test it shows Build Success but it doesn't execute Test cases. Could anybody helpout on this? Please find below my structure.

TestNG.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name = "FlipkartSmoke" verbose="1" thread-count="2" parallel="methods">
<test name = "FlipkartLogin">
<classes>
    <class name="runner.testrunner">
    </class>
</classes>
</test>
</suite>

testrunner.java:

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(
        features="src\\test\\java\\features",
        glue= {"seleniumGlueCode"},
        format= {"html:target"},
        monochrome=true,
        dryRun=false
        )

public class testrunner extends AbstractTestNGCucumberTests{

}

pom.xml:

<plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
          <configuration>
                 <includes>
                 <include>TestNG.xml</include>
             </includes>
      </configuration>
</plugin>

pom.xml:

<dependencies>
  
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
        
       <!-- ********************************************************************************  -->
         <!-- Selenium Dependencies  -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.7.0</version>
        </dependency>
        
        <!-- ********************************************************************************  -->
         <!-- Cucumber Dependencies  -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
        </dependency>
        
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.5</version>
        </dependency>
        
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>13.0.0</version>
        </dependency>
        
        
        <!-- ********************************************************************************  -->
         <!-- TestNG Dependencies  -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.10</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>4.2.0</version>
        </dependency>
        
        <!-- ********************************************************************************  -->
         <!-- Excel Read Dependencies  -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.1</version>
        </dependency>
        
        <!-- ********************************************************************************  -->
        <!-- Common io Dependencies  -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        
    </dependencies>

It is showing build success. But it is not executing test cases.But if i try with @runWith in testrunner as junit testcase means, Both feature files are executing.

RAGHUNATH
  • 187
  • 3
  • 13

1 Answers1

1

I think you are mixing JUnit testing and TestNG testing with the Surefire plugin. Even you are mixing "includes" with "suiteXmlFiles". So my advice for you would be to stop and read documentation, and write little Maven project with almost no Java code or minimum code and get the POM right working with the command mvn test. It is very important to get the basic project working properly and understand. https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html Staring with a lot of messy dependencies and code makes it a mess in your head anyway. Therefore start it with the basic staff.

tibor17
  • 1,043
  • 6
  • 9
  • thing is like i tried simple junit with cucumber. In that i can able to execute test cases as junit but if i try through maven means, it is showing build success but not executing test cases – RAGHUNATH Jul 15 '20 at 18:34
  • We in the Apache usually do not communicate about bugs at the stackoverflow because we do not see your project. The ideal situation would be to handle your project at the GitHub. Can you push your project to the GitHub? We can continue there and we can use all the style with PRs, issues, comments in commits, etc. – tibor17 Jul 15 '20 at 21:20