0

I am trying to run cucumber tests in eclipse using maven build as run configuration. When i run the configuration, build is getting success but browser does not invoke. Hence the test is not running. Tests are getting skipped, giving an info "Nothing to compile - all classes are up to date". I am able to run the same test successfully by running the feature file as cucumber feature.

Please suggest me why tests are getting skipped. Also let me know the steps for running the cucumber test as maven build. Below is the pom.xml that i am using. Also i am using vm arguments as "-Dcucumber.Options=--format html:target/cucumber-html-report --tags @Runme"

<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>Maven.Project</groupId>
  <artifactId>testMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven.Project-v1-testMaven</name>


    <properties>
        <corporate.test.url>http://google.com</corporate.test.url>
        <corporate.test.browser>Firefox</corporate.test.browser>
        <corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
    </properties>

  <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.42.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>test</id>
            <properties>
                <corporate.test.url>http://acc-about.hm.com</corporate.test.url>
                <corporate.test.browser>Firefox</corporate.test.browser>
                <corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
            </properties>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
    </build>


</project>
shruti
  • 33
  • 1
  • 6
  • Can you show the package structure of your project and where the test runner and feature files reside? – Jörn Horstmann Dec 12 '14 at 11:15
  • I am not able to upload the image due to less reputation here. But i have created feature file under src/test/resources and step definition and runner class files under src/test/java. – shruti Dec 12 '14 at 12:19

1 Answers1

0

Please remove the skiptests tag in your maven - surefire plugin...

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
       <skipTests>true</skipTests>
</configuration>

EDIT: please add the following lines in configuration

<suiteXmlFiles>
    <suiteXmlFile>${basedir}${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
<reportsDirectory>./test-output/archive/${timestamp}</reportsDirectory>

In here suiteXmlFile points to your xml file you are trying to run and reportsDirectory points to your output folder. In command line or if using eclipse in goal provide clean test -DsuiteFile=

Hope tthis would help.

Vivek Singh
  • 3,641
  • 2
  • 22
  • 27
  • After removing skiptest, 0 test are run. Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 – shruti Dec 12 '14 at 08:32
  • Hi @shruti...I have updated the answer, please check and let me know. – Vivek Singh Dec 15 '14 at 07:21
  • Thanks Vivek. I am able to run test now. Issue was related to naming convention. Tests should end with "test" though i was using surefire plugin. Somehow i did not face this issue on intelliJ but it occurred in Eclipse. – shruti Dec 17 '14 at 11:55
  • Sorry i didnt get u..."Tests should end with test" in a sense? – Vivek Singh Dec 17 '14 at 12:07
  • 1
    say for example, your runner class file should be named as "CukeRunnerTest.java" – shruti Dec 17 '14 at 12:09