0

I am having difficulties trying to execute my maven cucumber-JVM project through command line, the project works fine through eclipse environment, but im making a really silly mistake. Can some one point out what could it be, I will be attaching images of the error below,

<mainClass>cucumber.api.cli.Main</mainClass>
            <includePluginDependencies>true</includePluginDependencies>
            <arguments>
                <argument>--format</argument>
                <argument>junit:target/cucumber-junit-report/allcukes.xml</argument>
                <argument>--format</argument>
                <argument>pretty</argument>
                <argument>--format</argument>
                <argument>html:target/cucumber-html-report</argument>
                <argument>--tags</argument>
                <argument>@kings</argument>
                <argument>--glue</argument>
                <argument>com/Science_Ware/Bilal/KingsPostLogin/</argument>
                <argument>src/test/resources</argument>

            </arguments>

Above is my pom.xml file and my class directories , where I feel error could be. My feature files are in src/test/resources and my step class path is com.Science_Ware.Bilal.KingsPostLogin and my Classname is also KingsPostLogin.

C:\Users\********\My Documents\EclipseWork\Science-Ware>mvn exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Science-Ware 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ Science-Ware ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment
on MEXEC-6.
Feature: Login and clicking on Content Containers

  In Order to Work in Microsoft
  I want to log in
  and verify content containers

  @kings
  Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki
ngsPostLogin/kingspostlogin.feature:7←[0m
    ←[36mGiven ←[0m←[36mI am logged into system on "Mozilla"←[0m
    ←[36mAnd ←[0m←[36mI click on "<Content_Container>"←[0m
    ←[36mThen ←[0m←[36mProcess should be "<Expected_Result>"←[0m

    Examples:

  @kings
  Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki
ngsPostLogin/kingspostlogin.feature:15←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "OrderCentre"←[0m
    ←[33mThen ←[0m←[33mProcess should be "OrderCentreTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse   ←[90m# com/Science_Ware/Bilal/
KingsPostLogin/kingspostlogin.feature:16←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "AggregateOrders"←[0m
    ←[33mThen ←[0m←[33mProcess should be "AggregateOrdersTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse   ←[90m# com/Science_Ware/Bilal/
KingsPostLogin/kingspostlogin.feature:17←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "FreeFormatOrder"←[0m
    ←[33mThen ←[0m←[33mProcess should be "FreeFormatOrderTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki
ngsPostLogin/kingspostlogin.feature:18←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "GetAQuote"←[0m
    ←[33mThen ←[0m←[33mProcess should be "GetAQuoteTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse     ←[90m# com/Science_Ware/Bila
l/KingsPostLogin/kingspostlogin.feature:19←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "ComputerEquipment"←[0m
    ←[33mThen ←[0m←[33mProcess should be "ComputerEquipmentTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki
ngsPostLogin/kingspostlogin.feature:20←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "Oligos"←[0m
    ←[33mThen ←[0m←[33mProcess should be "OligosTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse ←[90m# com/Science_Ware/Bilal/Ki
ngsPostLogin/kingspostlogin.feature:21←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "eTracker"←[0m
    ←[33mThen ←[0m←[33mProcess should be "eTrackerTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse    ←[90m# com/Science_Ware/Bilal
/KingsPostLogin/kingspostlogin.feature:22←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "BrowseCategories"←[0m
    ←[33mThen ←[0m←[33mProcess should be "BrowseCategoriesTitle"←[0m

  @kings
  Scenario Outline: Loggin in Science Warehouse   ←[90m# com/Science_Ware/Bilal/
KingsPostLogin/kingspostlogin.feature:23←[0m
    ←[33mGiven ←[0m←[33mI am logged into system on "Mozilla"←[0m
    ←[33mAnd ←[0m←[33mI click on "BrowseSuppliers"←[0m
    ←[33mThen ←[0m←[33mProcess should be "BrowseSuppliersTitle"←[0m

9 Scenarios (←[33m9 undefined←[0m)
27 Steps (←[33m27 undefined←[0m)
0m0.000s


You can implement missing steps with the snippets below:

@Given("^I am logged into system on \"(.*?)\"$")
public void i_am_logged_into_system_on(String arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Given("^I click on \"(.*?)\"$")
public void i_click_on(String arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^Process should be \"(.*?)\"$")
public void process_should_be(String arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

Above is my command line execution which does not invoke any of my step methods. they just run without any output. I am using mvn exec:java command to execute.

user1584614
  • 1
  • 1
  • 4
  • So you're missing a number of methods in your steps file. The errors tell you this :) – Reimeus Oct 03 '14 at 10:36
  • I already have class file which provides these steps, also the second Given Should be @And. Also i just ran through my Runner Class and it works fine, just having problem through command prompt – user1584614 Oct 03 '14 at 10:41
  • Are the steps files in fact located in `com/Science_Ware/Bilal/KingsPostLogin/`? As it seems Cucumber cannot find them. – Marit Jan 04 '18 at 19:21

1 Answers1

1

I think there are two problems. First of all, you probably shouldn't run cucumber from the command line. To run them, just add a unit test which should look like so:

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@Cucumber.Options(
    // Enable one of these to run just some tests. Put regexp to match features in here.
//    name = {"^Preview"},
//    name = {"^Save"},
//    tags = { "@questionLibrary", "@addingCategory" },
    format = {"html:target/cucumber-html-report", "pretty:target/cucumber-json-report.json"},
    strict = true
)
public class RunCukesTest {
}

When Maven runs the tests, the Cucumber test runner will locate all the features, create a nice JUnit test suite and run it. That way, problems will show up as test failures.

The second problem is that Cucumber has found errors in your tests and reports them. You will need to read the output carefully to understand what is wrong and then fix your feature descriptions and/or the support code.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • I already have runner class which execute perfectly, I am only having problems when i run this through Command line. I only need to run this through command line so i can easily run using jenkins – user1584614 Oct 03 '14 at 13:46
  • In that case you did something wrong with your setup since Cucumber can't find the three step definitions near the end of the error output. – Aaron Digulla Oct 03 '14 at 14:15