Getting Exception in thread "main" for cucumber feature file

94 views
Skip to first unread message

Abhijit Biradar

unread,
Mar 2, 2018, 3:00:42 AM3/2/18
to Selenium Users
Hi Friends,

I am getting below error message when i run cucumber feature file. Can any one of you please advise me on this. Project details are mentioned below.

Error:

Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+

Options:

    -g, --glue PATH                    Where glue code (step definitions and hooks) is loaded from.
    -f, --format FORMAT[:PATH_OR_URL]  How to format results. Goes to STDOUT unless PATH_OR_URL is specified.
                                       Built-in FORMAT types: junit, html, pretty, progress, json.
                                       FORMAT can also be a fully qualified class name.
    -t, --tags TAG_EXPRESSION          Only run scenarios tagged with tags matching TAG_EXPRESSION.
    -n, --name REGEXP                  Only run scenarios whose names match REGEXP.
    -d, --[no-]-dry-run                Skip execution of glue code.
    -m, --[no-]-monochrome             Don't colour terminal output.
    -s, --[no-]-strict                 Treat undefined and pending steps as errors.
        --snippets                     Snippet name: underscore, camelcase
        --dotcucumber PATH_OR_URL      Where to write out runtime information. PATH_OR_URL can be a file system
                                       path or a URL.
    -v, --version                      Print version.
    -h, --help                         You're looking at it.

Exception in thread "main" cucumber.runtime.CucumberException: Unknown option: --plugin
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:50)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:44)
at cucumber.api.cli.Main.run(Main.java:20)
at cucumber.api.cli.Main.main(Main.java:16)
Login.Feature File

@SmokeTest 
Feature: LogIn Action Test
  Description: This feature will test a LogIn and LogOut functionality

  Scenario: Successful Login with Valid Credentials
    Given User is on Home Page
    When User Navigate to LogIn Page
    And User enters UserName and Password
    Then Message displayed Login Successfully
TestRunner.Java

package runners;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(features = {"MyTest2/feature/Login.feature"})
 
public class TestRunner {

}


Maven POM File

  <modelVersion>4.0.0</modelVersion>
  <groupId>Mytest2</groupId>
  <artifactId>Mytest2</artifactId>
  <version>0.0.1-SNAPSHOT</version> 
  <dependencies>
   <dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
 
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>1.1.5</version>
<type>pom</type>
</dependency>
 
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

Vikram

unread,
Mar 8, 2018, 12:19:50 PM3/8/18
to Selenium Users
Hi Abhijit,

You can compare your setup against my working project to see what is going wrong

https://github.com/vikramvi/serenity-cucumber-wl

Regards,
Vikram

George Dinwiddie

unread,
Mar 8, 2018, 12:50:40 PM3/8/18
to seleniu...@googlegroups.com
Cucumber-JVM 1.1.5 is 4-1/2 years old. It predates the --plugin option,
which was added in 1.2.0.

See https://github.com/cucumber/cucumber-jvm/blob/master/CHANGELOG.md

I suggest you start with https://github.com/cucumber/cucumber-java-skeleton

- George

On 3/2/18 3:00 AM, Abhijit Biradar wrote:
> Hi Friends,
>
> I am getting below error message when i run cucumber feature file. Can
> any one of you please advise me on this. Project details are mentioned
> below.
>
> *Error:*
> *Login.Feature File*
>
> @SmokeTest
> Feature: LogIn Action Test
>   Description: This feature will test a LogIn and LogOut functionality
>
>   Scenario: Successful Login with Valid Credentials
>     Given User is on Home Page
>     When User Navigate to LogIn Page
>     And User enters UserName and Password
>     Then Message displayed Login Successfully
> *TestRunner.Java*
>
> package runners;
>
> import org.junit.runner.RunWith;
>
> import cucumber.api.CucumberOptions;
>
> @RunWith(Cucumber.class)
> @CucumberOptions(features = {"MyTest2/feature/Login.feature"})
> public class TestRunner {
>
> }
>
>
> *Maven POM File*
>
> <project xmlns="http://maven.apache.org/POM/4.0.0
> <http://maven.apache.org/POM/4.0.0>
> http://maven.apache.org/xsd/maven-4.0.0.xsd
> --
> You received this message because you are subscribed to the Google
> Groups "Selenium Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to selenium-user...@googlegroups.com
> <mailto:selenium-user...@googlegroups.com>.
> To post to this group, send email to seleniu...@googlegroups.com
> <mailto:seleniu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/selenium-users/4d56ac5b-b317-40d2-b395-84b2dceca898%40googlegroups.com
> <https://groups.google.com/d/msgid/selenium-users/4d56ac5b-b317-40d2-b395-84b2dceca898%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages