Cucumber feature files are not running via POM.XML

605 views
Skip to first unread message

Pankaj Tiwari

unread,
Jul 6, 2017, 12:09:16 PM7/6/17
to Cukes
Hi Friends,

Now days I am facing a weird issue in my Cucumber framework.

When I am running my feature file through Runner class or through Run As >> Feature file its running fine but when i am trying to run it through POM.XML the execution is not starting.

I am getting below response in console.

0 Scenarios
0 Steps
0m0.000s

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.489 sec - in com.application.Runner.Runner

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Configuration :
Java : 1.8.0_121
Maven : 3.2.5

Though its not giving any error but execution is not starting and its finishing with Build Success with above message in console.

Previously we were using JDK 1.7 and we are facing this issue when we moved to 1.8.

Note : If its versioning issue then it should not run through Runner and feature file itself but the problem only when we try to run it through POM.XML

Please help as i google lot but didn't find any solution.

Let me know in case you require more info regarding this.

Below are the dependencies with version which we are using with above Java and Maven version.

 <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.2.4</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.4</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.2.4</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>gherkin</artifactId>
            <version>2.12.2</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>1.2.4</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-html</artifactId>
            <version>0.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.epo.test-automation</groupId>
            <artifactId>edossier-test</artifactId>
            <version>1.0.10-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-compress</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-picocontainer</artifactId>
            <version>1.2.4</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.0.0-M3</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.1</version>
        </dependency>
        <dependency>
            <groupId>com.vimalselvam</groupId>
            <artifactId>cucumber-extentsreport</artifactId>
            <version>1.1.1</version>
        </dependency>


        <dependency>
            <groupId>com.github.mkolisnyk</groupId>
            <artifactId>cucumber-reports</artifactId>
            <version>0.0.11</version>
        </dependency>
       
        <dependency>
            <groupId>org.tmatesoft.svnkit</groupId>
            <artifactId>svnkit</artifactId>
            <version>1.8.11</version>
        </dependency>
        <dependency>
             <groupId>org.epo.test-automation</groupId>
            <artifactId>test-common</artifactId>
            <version>3.0.50</version>
        </dependency>
                
        <dependency>
                <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>3.0.2</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/json-path -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>3.0.2</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-junit -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-junit</artifactId>
            <version>2.0.0.0</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>3.0.2</version>
        </dependency>
      
<dependency>

    <groupId>io.rest-assured</groupId>

    <artifactId>rest-assured</artifactId>

    <version>3.0.2</version>

</dependency>

<!-- https://mvnrepository.com/artifact/io.rest-assured/json-path -->

<dependency>

    <groupId>io.rest-assured</groupId>

    <artifactId>json-path</artifactId>

    <version>3.0.2</version>

</dependency>

<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all -->

<dependency>

    <groupId>org.hamcrest</groupId>

    <artifactId>hamcrest-all</artifactId>

    <version>1.3</version>

</dependency>

<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-junit -->

<dependency>

    <groupId>org.hamcrest</groupId>

    <artifactId>hamcrest-junit</artifactId>

    <version>2.0.0.0</version>

</dependency>

<!-- https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->

<dependency>

    <groupId>io.rest-assured</groupId>

    <artifactId>json-schema-validator</artifactId>

    <version>3.0.2</version>

</dependency>
    <dependency>
      <groupId>com.sikulix</groupId>
      <artifactId>sikulixapi</artifactId>
      <version>1.1.2-SNAPSHOT</version>
    </dependency>
       </dependencies>
 

-Thanks
Pankaj

Thomas Sundberg

unread,
Jul 6, 2017, 5:40:50 PM7/6/17
to Cukes
Hi!

Please share information regarding the name and content of the runner
class and the location of the steps.

As an experiment, change the jvm from 1.8 to 1.7 and tell us the
result. I would be very surprised if your problem was connected to the
java version. It sounds more like a Maven issue to me.

/Thomas
> --
> Posting rules: http://cukes.info/posting-rules.html
> ---
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cukes+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://www.thinkcode.se/blog
Twitter: @thomassundberg

Better software through faster feedback

Paolo Ambrosio

unread,
Jul 7, 2017, 1:19:11 AM7/7/17
to cu...@googlegroups.com
More than the location of the steps, it's the location of the feature
files that looks wrong to me (in com.application.Runner.Runner?).

Agree on everything else :-)

Pankaj Tiwari

unread,
Jul 7, 2017, 1:29:44 AM7/7/17
to Cukes, t...@kth.se
Hi,

The name of ruunner class is Runner.java. Below is the content of the Runner class

@RunWith(ExtendedCucumber.class)
@ExtendedCucumberOptions(jsonReport = "target/cucumber.json", retryCount = 0)
@CucumberOptions(plugin = { "com.cucumber.listener.ExtentCucumberFormatter",
        "html:target/cucumber-html-report/testFeature.html", "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
        "junit:target/cucumber-results.xml" },features = {"./src/test/resources/features/tp/MyTest.feature"},
        glue={"com.application.stepdefs"},
            monochrome = true/*tags = "@Regression"*/)

public class Runner {

    @BeforeClass
    public static void setup() {
/*
* Initiates the extent report and generates the output in the output/Run_<unique timestamp>/report.html file by default.
*/
        //ExtentCucumberFormatter.initiateExtentCucumberFormatter();
        ExtentCucumberFormatter.initiateExtentCucumberFormatter(new File("C:/Development/EPO/Cucumber_Framework/target/Advance-Reports/report_.html"));
        ExtentCucumberFormatter.loadConfig(new File("src/test/resources/extent-config.xml"));

  /*
   *  User can add the system information as follows
   */
        ExtentCucumberFormatter.addSystemInfo("Browser Name", "chrome");
        ExtentCucumberFormatter.addSystemInfo("Browser version", "v41.0");
        ExtentCucumberFormatter.addSystemInfo("Selenium version", "v2.53.0");

  /*
   * User can add system information using a hash map
   */
        Map systemInfo = new HashMap();
        systemInfo.put("Cucumber version", "v1.2.3");
        systemInfo.put("Extent Cucumber Reporter version", "v1.1.1");
        ExtentCucumberFormatter.addSystemInfo(systemInfo);
    }
}

About jvm, Are you talking about to change the JDK from 1.8 to 1.7  or cucumber-jvm ?

Let me in case you have any query.

-Thanks
Pankaj

Pankaj Tiwari

unread,
Jul 7, 2017, 1:32:09 AM7/7/17
to Cukes
com.application.Runner.Runner? - My Runner class is in inside the com.application.Runner package.

I think if there is any problem with above then it should also not run via Runner class or via feature file itself
Let me know in case you require more info regarding the same.

-Thanks
Pankaj

Paolo Ambrosio

unread,
Jul 7, 2017, 2:12:02 AM7/7/17
to cu...@googlegroups.com
Try

features = {"classpath:features/tp/MyTest.feature"}

assuming that the file "src/test/resources/features/tp/MyTest.feature"
exists in your project.

Cheers,
Paolo

Pankaj Tiwari

unread,
Jul 7, 2017, 3:34:45 AM7/7/17
to Cukes
Tried with same , but the issue is still same.

Here is the output from console :

[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ cucumberframework ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ cucumberframework ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ cucumberframework ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 62 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ cucumberframework ---
[INFO] Compiling 47 source files to C:\Development\Test\CucumberTest\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ cucumberframework ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.application.Runner.Runner
Running Feature child (scenario)...
Begin scenario run...
Initiating retry...
Current class is: com.github.mkolisnyk.cucumber.runner.ExtendedExecutionUnitRunner
Scenario completed...0
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


0 Scenarios
0 Steps
0m0.000s

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.334 sec - in com.application.Runner.Runner


Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ cucumberframework ---
[INFO] Building jar: C:\Development\Test\CucumberTest\target\cucumberframework-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-site-plugin:3.1:attach-descriptor (attach-descriptor) @ cucumberframework ---
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ cucumberframework ---
[INFO] Installing C:\Development\Test\CucumberTest\target\cucumberframework-1.0-SNAPSHOT.jar to c:\Development\.m2\repository\epo\cucumberframework\1.0-SNAPSHOT\cucumberframework-1.0-SNAPSHOT.jar
[INFO] Installing C:\Development\Test\CucumberTest\pom.xml to c:\Development\.m2\repository\epo\cucumberframework\1.0-SNAPSHOT\cucumberframework-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.881 s
[INFO] Finished at: 2017-07-07T09:30:41+02:00
[INFO] Final Memory: 47M/419M
[INFO] ----------------------

Here is the configuration of Ruuner file :

@RunWith(ExtendedCucumber.class)
@ExtendedCucumberOptions(jsonReport = "target/cucumber.json", retryCount = 0)
@CucumberOptions(plugin = { "com.cucumber.listener.ExtentCucumberFormatter",
        "html:target/cucumber-html-report/testFeature.html", "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
        "junit:target/cucumber-results.xml" },features = {"classpath:features/tp/MyTest.feature"},

        glue={"com.application.stepdefs"},
            monochrome = true/*tags = "@Regression"*/)

public class Runner {

    @BeforeClass
    public static void setup() {
/*
* Initiates the extent report and generates the output in the output/Run_<unique timestamp>/report.html file by default.
*/
        //ExtentCucumberFormatter.initiateExtentCucumberFormatter();
        ExtentCucumberFormatter.initiateExtentCucumberFormatter(new File("C:/Development/EPO/Cucumber_Framework/target/Advance-Reports/report_.html"));
        ExtentCucumberFormatter.loadConfig(new File("src/test/resources/extent-config.xml"));

  /*
   *  User can add the system information as follows
   */
        ExtentCucumberFormatter.addSystemInfo("Browser Name", "chrome");
        ExtentCucumberFormatter.addSystemInfo("Browser version", "v41.0");
        ExtentCucumberFormatter.addSystemInfo("Selenium version", "v2.53.0");

  /*
   * User can add system information using a hash map
   */
        Map systemInfo = new HashMap();
        systemInfo.put("Cucumber version", "v1.2.3");
        systemInfo.put("Extent Cucumber Reporter version", "v1.1.1");
        ExtentCucumberFormatter.addSystemInfo(systemInfo);
    }
}


Let me know in case you require more info.

Thanks
Pankaj

Thomas Sundberg

unread,
Jul 7, 2017, 3:49:04 AM7/7/17
to Cukes
Hi!

Your problem may be that you call your runner class "Runner" and
expect Maven to pick it up as a test class.

Unfortunately, the Maven test-runner Surefire will only look for
classes that start with Test or end with Test.

Rename your runner class to RunnerTest and give a try.

Another potential problem is the location of the scenarios as
suggested. I always keep my steps and scenarios in the same package or
a subpackage to the runner to avoid problems of pointing out the
files. Cucumber will pick up all scenarios and steps it can find in
the classpath in the same package or a subpackege to the runner class.

A third thing I would look into is the annotation
@RunWith(ExtendedCucumber.class)
I don't know what the "ExtendedCucumber.class" is. I have never used
it. Does it have issues?

HTH
Thomas
Reply all
Reply to author
Forward
0 new messages