Discussion:
[Cucumber] Running Cucumber-JVM from a command line
(too old to reply)
Alex
2012-05-16 01:50:30 UTC
Permalink
Raw Message
I am having trouble to run cucumber-jvm from a command line. The
command is executed from a directory containing cucumber JAR files.
Having said that, I have no problem running Cucumber-JVM from IntelliJ
by running the test class (RunCukesTest) annotated with
@RunWith(Cucumber.class).

The command is as follows:
java -classpath gherkin-2.9.3.jar:cucumber-junit-1.0.6.jar:cucumber-
java-1.0.6.jar:cucumber-core-1.0.6.jar: cucumber.cli.Main --glue ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance/
invoiceresource.feature

The directory "~/application/out/test/Acceptance/com/gap/scms/mp/
acceptance/" contains the following files (everything in one
directory):
InvoiceResourceStepdefs.class
RunCukesTest.class
invoiceresource.feature

The following is the contents of invoiceresource.feature:
https://gist.github.com/2706621

The following is the contents of RunCukesTest class:
https://gist.github.com/2706631

The following is the contents of InvoiceResourceStepdefs class:
https://gist.github.com/2706638

The response that I get is as follows (I see the auto-generated
stepdefs message):
https://gist.github.com/2706587
From what I see, the cucumber-jvm cannot locate the
InvoiceResourceStepdefs class. Can you please advise where I am going
wrong? Thank you

Alex

-- There are two rules:

1) Please prefix the subject with [Ruby], [JVM] or [JS]. This allows people to filter messages.
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
aslak hellesoy
2012-05-16 06:35:50 UTC
Permalink
Raw Message
Post by Alex
I am having trouble to run cucumber-jvm from a command line. The
command is executed from a directory containing cucumber JAR files.
Having said that, I have no problem running Cucumber-JVM from IntelliJ
by running the test class (RunCukesTest) annotated with
@RunWith(Cucumber.class).
java -classpath gherkin-2.9.3.jar:cucumber-junit-1.0.6.jar:cucumber-
java-1.0.6.jar:cucumber-core-1.0.6.jar: cucumber.cli.Main --glue ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance/
invoiceresource.feature
The directory "~/application/out/test/Acceptance/com/gap/scms/mp/
acceptance/" contains the following files (everything in one
InvoiceResourceStepdefs.class
RunCukesTest.class
invoiceresource.feature
https://gist.github.com/2706621
https://gist.github.com/2706631
https://gist.github.com/2706638
This class needs to be in a package. You placed it in the top-level
package (no package).
It also shouldn't extend from ResourceTest. In fact it shouldn't
extend anything. See recent discussions about inheritance.
Post by Alex
The response that I get is as follows (I see the auto-generated
https://gist.github.com/2706587
From what I see, the cucumber-jvm cannot locate the
InvoiceResourceStepdefs class. Can you please advise where I am going
wrong?
The java backend expects the --glue argument to be either a package
name or a classpath path (not a file system path). So after you have
moved your InvoiceResourceStepdefs class to a package, for example
com.yammer.dropwizard.testing, cucumber will pick it up with:

--glue com.yammer.dropwizard.testing

Or alternatively

--glue classpath:com/yammer/dropwizard/testing

Other backends, such as the jruby backend would be happy to use a file
system path. Different backends want different ways to specify a glue
location.

If you look at the history
(https://github.com/cucumber/cucumber-jvm/blob/master/History.md)
you'll see that 1.0.2 introduced "Don't convert paths to package names
- instead throw an exception. This helps people avoid mistakes." If
you had been on 1.0.2 you would have received an exception!

However, this introduced another problem:
https://github.com/cucumber/cucumber-jvm/issues/299 so you'll no
longer get this warning if you pass a file system path.

I'll try to come up with a way for cucumber to detect bad glue while
avoiding #299 to break again.

HTH,
Aslak
Post by Alex
Thank you
Alex
1) Please prefix the subject with [Ruby], [JVM] or [JS]. This allows people to filter messages.
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
-- There are two rules:

1) Please prefix the subject with [Ruby], [JVM] or [JS]. This allows people to filter messages.
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Alex
2012-05-16 23:03:53 UTC
Permalink
Raw Message
Hi Aslak,

Thank you for the pointers. I got it working now. My stepdefs class
now not extending anything as per your pointer,
but uses class that extends ResourceTest.

My command now looks as follows (I am running it from my project libs
dir):

java -classpath *:[system_path_to_compiled_classes]:
[system_path_to_compiled_test_classes] cucumber.cli.Main \
--glue [package_name] classpath:[system_path_to_features] --tags
[some_tag_name_starting_with_@]

Thank you for your help and the quick feedback.

Alex
Post by aslak hellesoy
Post by Alex
I am having trouble to run cucumber-jvm from a command line. The
command is executed from a directory containing cucumber JAR files.
Having said that, I have no problem running Cucumber-JVM from IntelliJ
by running the test class (RunCukesTest) annotated with
@RunWith(Cucumber.class).
java -classpath gherkin-2.9.3.jar:cucumber-junit-1.0.6.jar:cucumber-
java-1.0.6.jar:cucumber-core-1.0.6.jar: cucumber.cli.Main --glue ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance/
invoiceresource.feature
The directory "~/application/out/test/Acceptance/com/gap/scms/mp/
acceptance/" contains the following files (everything in one
InvoiceResourceStepdefs.class
RunCukesTest.class
invoiceresource.feature
https://gist.github.com/2706621
https://gist.github.com/2706631
https://gist.github.com/2706638
This class needs to be in a package. You placed it in the top-level
package (no package).
It also shouldn't extend from ResourceTest. In fact it shouldn't
extend anything. See recent discussions about inheritance.
Post by Alex
The response that I get is as follows (I see the auto-generated
https://gist.github.com/2706587
From what I see, the cucumber-jvm cannot locate the
InvoiceResourceStepdefs class. Can you please advise where I am going
wrong?
The java backend expects the --glue argument to be either a package
name or a classpath path (not a file system path). So after you have
moved your InvoiceResourceStepdefs class to a package, for example
    --glue com.yammer.dropwizard.testing
Or alternatively
    --glue classpath:com/yammer/dropwizard/testing
Other backends, such as the jruby backend would be happy to use a file
system path. Different backends want different ways to specify a glue
location.
If you look at the history
(https://github.com/cucumber/cucumber-jvm/blob/master/History.md)
you'll see that 1.0.2 introduced "Don't convert paths to package names
- instead throw an exception. This helps people avoid mistakes." If
you had been on 1.0.2 you would have received an exception!
However, this introduced another problem:https://github.com/cucumber/cucumber-jvm/issues/299so you'll no
longer get this warning if you pass a file system path.
I'll try to come up with a way for cucumber to detect bad glue while
avoiding #299 to break again.
HTH,
Aslak
Post by Alex
Thank you
Alex
1) Please prefix the subject with [Ruby], [JVM] or [JS]. This allows people to filter messages.
2) Please use interleaved answershttp://en.wikipedia.org/wiki/Posting_style#Interleaved_style
-- There are two rules:

1) Please prefix the subject with [Ruby], [JVM] or [JS]. This allows people to filter messages.
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
Justin Radcliffe
2016-05-31 13:37:18 UTC
Permalink
Raw Message
In Eclipse I creates a maven project that is building my JARs will all the
dependacys. So I have that plug the lib folder in the project on my
classpath.

Automation_Framework - is my eclipse java project.
com.justin.testcases has more package levels with other cucumber test
files. Just using tags to know which one to use. Let me know if you need
more details.

C:\ALM\Automation_Framework>java -cp
lib\*;target\62100_Automation-0.0.1-SNAPSHOT-jar-with-dependencies.jar
cucumber.api.cli.Main --glue com.justin.testcases
C:\ALM\Automation_Framework\src\test\resources\com\justin\testcases\testsuite\gccx
Post by Alex
I am having trouble to run cucumber-jvm from a command line. The
command is executed from a directory containing cucumber JAR files.
Having said that, I have no problem running Cucumber-JVM from IntelliJ
by running the test class (RunCukesTest) annotated with
@RunWith(Cucumber.class).
java -classpath gherkin-2.9.3.jar:cucumber-junit-1.0.6.jar:cucumber-
java-1.0.6.jar:cucumber-core-1.0.6.jar: cucumber.cli.Main --glue ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance/
invoiceresource.feature
The directory "~/application/out/test/Acceptance/com/gap/scms/mp/
acceptance/" contains the following files (everything in one
InvoiceResourceStepdefs.class
RunCukesTest.class
invoiceresource.feature
https://gist.github.com/2706621
https://gist.github.com/2706631
https://gist.github.com/2706638
The response that I get is as follows (I see the auto-generated
https://gist.github.com/2706587
From what I see, the cucumber-jvm cannot locate the
InvoiceResourceStepdefs class. Can you please advise where I am going
wrong? Thank you
Alex
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sneha Kalgutkar
2018-08-17 13:03:10 UTC
Permalink
Raw Message
Hi Aslak,

I have a framework which uses Spring alongwith Cucumber and Maven with
selenium as well. I tried all of the options to execute my jar, but it
failes with a null pointer exception at a line where i am trying to load
properties file with @Autowire annotation of Spring and use it. The files
are getting loaded at run time, i verified it in logs but the
Environment(of org
<eclipse-javadoc:%E2%98%82=RedWingConsoleUI/C:%5C/FAST%5C/maven%5C/repo%5C/org%5C/springframework%5C/spring-core%5C/5.0.7.RELEASE%5C/spring-core-5.0.7.RELEASE.jar%3Corg>
.springframework
<eclipse-javadoc:%E2%98%82=RedWingConsoleUI/C:%5C/FAST%5C/maven%5C/repo%5C/org%5C/springframework%5C/spring-core%5C/5.0.7.RELEASE%5C/spring-core-5.0.7.RELEASE.jar%3Corg.springframework>
.core
<eclipse-javadoc:%E2%98%82=RedWingConsoleUI/C:%5C/FAST%5C/maven%5C/repo%5C/org%5C/springframework%5C/spring-core%5C/5.0.7.RELEASE%5C/spring-core-5.0.7.RELEASE.jar%3Corg.springframework.core>
.env
<eclipse-javadoc:%E2%98%82=RedWingConsoleUI/C:%5C/FAST%5C/maven%5C/repo%5C/org%5C/springframework%5C/spring-core%5C/5.0.7.RELEASE%5C/spring-core-5.0.7.RELEASE.jar%3Corg.springframework.core.env>.Environment)
is not getting initialised.

The proejct executes perfectly fine with mvn test, mvn package, but the
execution via jar fails.

Any help/ pointers in this will be of great help.
Post by Alex
I am having trouble to run cucumber-jvm from a command line. The
command is executed from a directory containing cucumber JAR files.
Having said that, I have no problem running Cucumber-JVM from IntelliJ
by running the test class (RunCukesTest) annotated with
@RunWith(Cucumber.class).
java -classpath gherkin-2.9.3.jar:cucumber-junit-1.0.6.jar:cucumber-
java-1.0.6.jar:cucumber-core-1.0.6.jar: cucumber.cli.Main --glue ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance ~/
application/out/test/Acceptance/com/gap/scms/mp/acceptance/
invoiceresource.feature
The directory "~/application/out/test/Acceptance/com/gap/scms/mp/
acceptance/" contains the following files (everything in one
InvoiceResourceStepdefs.class
RunCukesTest.class
invoiceresource.feature
https://gist.github.com/2706621
https://gist.github.com/2706631
https://gist.github.com/2706638
The response that I get is as follows (I see the auto-generated
https://gist.github.com/2706587
From what I see, the cucumber-jvm cannot locate the
InvoiceResourceStepdefs class. Can you please advise where I am going
wrong? Thank you
Alex
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...