Cucumber-java


#1

Hi all,

Does anyone have an example of how to get the cucumber-java simple
example
running? I would like to use cucumber-java but cannot figure out how.

I’ve gem installed cucumber and cucumber-java. When I run mvn clean
package
in the simple directory, I get this error:

19:41:48 agentdh-2:~/Development/tools/cucumber_java/examples/simple
rbarlow$ mvn clean package
Using Java version: 1.5
[INFO] Scanning for projects…
[INFO]

[INFO] Building Cucumber Simple Example
[INFO] task-segment: [clean, package]
[INFO]

Downloading:
http://repo1.maven.org/maven2/cucumber/cucumber-java-parent/0.0.2/cucumber-java-parent-0.0.2.pom
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Failed to resolve artifact.

GroupId: cucumber
ArtifactId: cucumber-java-parent
Version: 0.0.2

Reason: Unable to download the artifact from any repository

cucumber:cucumber-java-parent:pom:0.0.2

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

[INFO]

[INFO] For more information, run Maven with the -e switch
[INFO]

[INFO] Total time: 1 second
[INFO] Finished at: Sat May 16 19:41:52 BST 2009
[INFO] Final Memory: 1M/3M
[INFO]

Any suggestions? Or does anyone have an equivalent ant script?

Cheers,
Raymond B.


#2

Using Java version: 1.5


[INFO] Total time: 1 second
[INFO] Finished at: Sat May 16 19:41:52 BST 2009
[INFO] Final Memory: 1M/3M
[INFO]

Any suggestions? Or does anyone have an equivalent ant script?

Try mvn install from the root folder first.

Aslak


#3

OK, that seemed to help a bit. That installed a bunch of stuff, and then
I
did the mvn clean package in the examples directory–which built the
example
jar.

So I guess my next step would be to
cucumber features
in the featuers directory of the simple example?

I tried this a got an error about pico_container. So I thought that
maybe I
hadn’t setup correctly.

So, back to the start.

did
jruby -S gem install hoe --no-rdoc --no-ri
and that worked fine.

The next step listed on the cucumber-java
pagehttp://github.com/aslakhellesoy/cucumber_java/tree/masteris to
jruby -S rake gem

when I do this, I get this error:
(in /Users/rbarlow/Development/tools/cucumber_java)
rake aborted!
Don’t know how to build task ‘gem’

(See full trace by running task with --trace)

Am I perhaps in the wrong directory when I do this?

Sorry, just feeling my way around at the moment.

Cheers!
Raymond B.
2009/5/16 aslak hellesoy removed_email_address@domain.invalid


#4

On Sun, May 17, 2009 at 12:01 AM, Raymond B.
removed_email_address@domain.invalidwrote:

(in /Users/rbarlow/Development/tools/cucumber_java)
rake aborted!
Don’t know how to build task ‘gem’

The task you are referring to should be run from the cucumber-java
subproject, not the root project.
I have had problems running the rake tasks using Windows (both cygwin
and
the regular cmd-tool) and had to edit the Rakefile manually for my
environment.
After installing your own gem using jruby -S gem install pkg/cucumber…
you
can run mvn cucumber:features from each of the example-projects.


#5

On Sun, May 17, 2009 at 12:01 AM, Raymond B. removed_email_address@domain.invalid
wrote:

Can you tell us exactly what the error and stacktrace was.

(in /Users/rbarlow/Development/tools/cucumber_java)

Sorry about the sparse documentation. I think we should yank all the
README files and start using the wiki instead. Any objections?


#6

On Mon, May 18, 2009 at 10:02 AM, aslak hellesoy
removed_email_address@domain.invalidwrote:

in the featuers directory of the simple example?
did

README files and start using the wiki instead. Any objections?
Should development information be stacked in the wiki? I agree that the
README files are in desperate need of a cleanup…


#7

I agree. I’m still not able to get cucumber-java working. If I am
successful, I would be happy to upload a ‘from woah to go’ set of
instructions.

/Raymond

2009/5/18 aslak hellesoy removed_email_address@domain.invalid


#8

example

Sorry, just feeling my way around at the moment.

Sorry about the sparse documentation. I think we should yank all the
README files and start using the wiki instead. Any objections?

Should development information be stacked in the wiki? I agree that the
README files are in desperate need of a cleanup…

I think it should. There is a very blurry line between user doc and
developer doc, and by having it in the Wiki it’s easier for everyone
to improve it.

Aslak


#9

I believe (someone correct me if I’m wrong…) that the version of
cucumber_java you have installed is an older version from a central
repository. cucumber/pico_container is the result of a recent
refactoring
(as is cucumber/spring).
For me it helped to use cp instead of mv in the Rakefile at some point.
And
to remove the line executing mvn from the rake task. Then I was able to
install the updated gem.

regards, Trond


#10

Hi Trond,

Thanks for your help!

For a start, I’m running OSX (not windoze).

OK, it seems that I have successfully installed the cucmber-java
gem…I
think. I couldn’t get the

jruby -S rake gem

step to work from the cucumber-java directory. If I did this, all I get
is

  • README.txt is missing or in the wrong format for auto-intuiting.
    run sow blah and look at its text files
    ** History.txt is missing or in the wrong format for auto-intuiting.
    run sow blah and look at its text files
    rake aborted!
    Don’t know how to build task ‘lib/cucumber-java-0.0.2.jar’

(See full trace by running task with --trace)

It seems that I can install the cucumber-java gem by just doing

jruby -S gem install cucumber-java

So I definitely have cucumber-java gem installed. I assume that now I
should
be able to run the examples. But, if I go to the
examples/simple/features
directory, and run

$ jruby -S cucumber features
no such file to load – cucumber/pico_container
Failed to load ./support/env.rb (LoadError)
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:81:in
require_files' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:75:ineach’
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:75:in
require_files' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:34:inexecute!’
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:20:in
execute' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:8 /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:19:inload’
/Users/dev/tools/jruby-1.1.4/bin/cucumber:19

So I then added the directory with cucumber/pico_container.rb in it to
the
classpath. try again, and now get

no such file to load – cucumber-java-0.0.2
Failed to load ./support/env.rb (LoadError)
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:81:in
require_files' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:75:ineach’
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:75:in
require_files' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:34:inexecute!’
/Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:20:in
execute' /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:8 /Users/dev/tools/jruby-1.1.4/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:19:inload’
/Users/dev/tools/jruby-1.1.4/bin/cucumber:19

So, I guess I have again missed something…

Cheers,
Raymond B.

2009/5/18 Trond Marius Øvstetun removed_email_address@domain.invalid


#11

Run the examples using maven, or you have to set your classpath
yourself…

Trond.


#12

With your help I am progressing :slight_smile:

I’ve managed to install the cucmber-java gem. But now, if I

jruby -S cucumber features

from any directory, I get this error:

cannot link Java class cucumber.internal.PicoContainerStepMother,
probable
missing dependency: org/picocontainer/MutablePicoContainer (NameError)
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:in
const_missing' /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-java-0.0.2/lib/cucumber/pico_container.rb:2 /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-java-0.0.2/lib/cucumber/pico_container.rb:36:inrequire’
/Users/dev/tools/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require' /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:inrequire’
./simple/features/support/env.rb:1
./simple/features/support/env.rb:31:in require' /Users/dev/tools/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:in
require' /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:77:inrequire_files’
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:75:in
each' /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:75:inrequire_files’
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/…/lib/cucumber/cli/main.rb:34:in
execute!' /Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/../lib/cucumber/cli/main.rb:20:inexecute’
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:8
/Users/dev/tools/jruby-1.2.0/lib/ruby/gems/1.8/gems/cucumber-0.3.5/bin/cucumber:19:in
`load’
/Users/dev/tools/jruby/bin/cucumber:19

ideas?

:slight_smile:

Oh, and another question, is the above command the correct thing to run
to
see the examples run? And if so, do I run it in examples/simple or
examples/simple/features?

/Raymond

2009/5/18 Trond Marius Øvstetun removed_email_address@domain.invalid


#13

Run the examples using maven, or you have to set your classpath yourself…

See README.textile in simple and spring. It has some command line
snippets with classpath. I use this to omit Maven.


#14

Trond Marius Øvstetun wrote:

I believe (someone correct me if I’m wrong…) that the version of
cucumber_java you have installed is an older version from a central
repository. cucumber/pico_container is the result of a recent
refactoring
(as is cucumber/spring).
For me it helped to use cp instead of mv in the Rakefile at some point.
And
to remove the line executing mvn from the rake task. Then I was able to
install the updated gem.

regards, Trond

I’m having the same problem as Raymond, but on Windoze. Is there another
version? The only I can seem to find is the 0.0.1 on
http://github.com/aslakhellesoy/cucumber_java/downloads


#15

regards, Trond

I’m having the same problem as Raymond, but on Windoze. Is there another
version? The only I can seem to find is the 0.0.1 on
http://github.com/aslakhellesoy/cucumber_java/downloads

No more recent versions have been released since 0.0.1. There are some
bugfixes on Github, but you have to build it yourself. I’ll announce
here when there is a new release. Any help moving it forward is
appreciated.

Aslak


#16

Aslak Hellesøy wrote:

regards, Trond

I’m having the same problem as Raymond, but on Windoze. Is there another
version? The only I can seem to find is the 0.0.1 on
http://github.com/aslakhellesoy/cucumber_java/downloads

No more recent versions have been released since 0.0.1. There are some
bugfixes on Github, but you have to build it yourself. I’ll announce
here when there is a new release. Any help moving it forward is
appreciated.

Aslak
Thanks for letting me know. I think getting Cucumber working directly
with Java is a great idea!! and I appreciate the efforts already put in.
At first I thought the calls had to go through jruby. The native java
support is important for java groups so they don’t need to learn another
language (unless they are lucky enough to be transitioning to Ruby, but
I suspect it will be a long time for many teams). I’ll try to help, but
I suspect I’ll consume more resources getting going than the benefits
added :slight_smile:

I’ll work on getting the latest out of git.

Shane


#17

bugfixes on Github, but you have to build it yourself. I’ll announce
here when there is a new release. Any help moving it forward is
appreciated.

Aslak

I have the latest from github, and there is still a dependency on
pico-container, here is the error: no such file to load –
cucumber/pico_container after ‘jruby -S cucumber features’.

Then you must be running a previous release. Get rid of it. Look
higher up in this thread.


#18

Raymond B. wrote:

Oh, and another question, is the above command the correct thing to run
to
see the examples run? And if so, do I run it in examples/simple or
examples/simple/features?

/Raymond

2009/5/18 Trond Marius Øvstetun removed_email_address@domain.invalid

Hi Raymond. Did you get it to run on your system? I have not had success
yet, so I would get some hope if you got it to run on yours.

Regards,
Shane


#19

Aslak Hellesøy wrote:

regards, Trond

I’m having the same problem as Raymond, but on Windoze. Is there another
version? The only I can seem to find is the 0.0.1 on
http://github.com/aslakhellesoy/cucumber_java/downloads

No more recent versions have been released since 0.0.1. There are some
bugfixes on Github, but you have to build it yourself. I’ll announce
here when there is a new release. Any help moving it forward is
appreciated.

Aslak

I have the latest from github, and there is still a dependency on
pico-container, here is the error: no such file to load –
cucumber/pico_container after ‘jruby -S cucumber features’.
Any hints on installing pico-container? (gem vs jar)I’ll guess the gem
into JRuby, but I’m not sure.

Shane