Transitioning from Cuke4Duke to Cucumber-JVM

4,702 views
Skip to first unread message

aslak hellesoy

unread,
Aug 18, 2011, 11:01:24 AM8/18/11
to Cucumber Users
TL;DR: Cuke4Duke is dead. Viva Cucumber-JVM.

When Cucumber (the original ruby implementation) become somewhat
mature a couple of years ago I was thinking: Cucumber can run on JRuby
as well, and with some glue code it should be possible to write Step
Definitions in various JVM languages such as Java, Groovy, Scala,
Clojure etc. So Cuke4Duke was born.

It has worked well for some, less well for others. Since day 1 it has
had several inherent problems:

1) Hard to install. Cuke4Duke is based on JRuby, the Cucumber gem and
the Gherkin gem. Installing these in a Java environment is hard.
2) Slow. Every time you want to run a feature you have to wait for
JRuby to boot.
3) Hard to use. Maven makes it a little easier perhaps, but Maven
comes with its own warts.
4) Unstable. Consider the blocks that build up Cuke4Duke: JVM, JRuby,
RubyGems, Cucumber gem, Gherkin gem, Maven. For the sake of
simplicity, let's assume that each of those exists in 4 versions. That
means some 15.000 different combinations people might have on their
machines. And then there is Windows/Linux/OS X differences on top of
that.
5) Hard to test. Given the number of different permutations this
speaks for itself.
6) Hard to package and release. A hodge podge of Maven and Rake, plus
dealing with all of the dependencies.

The problems have been getting worse lately, and it's time to retire
the project because of its inherent flaws. As of today I will no
longer maintain Cuke4Duke. Instead I'll spend my time working on a
better replacement.

As some of you may know, I have been working on a pure JVM
implementation of Cucumber for a while. It incorporates the good parts
of Cuke4Duke, but not the bad ones (I hope). I think it's good enough
that some people can start playing with it. Here is where it's at:

* Mostly API compatible with Cuke4Duke
* Gherkin features can remain unchanged
* Step Definitions and Hooks will have to change some import statements
* The Java implementation is tested better than the other JVM
languages like Groovy etc, but they are there too.
* Scala has no support yet, will add that later.
* You can run features with JUnit
* A (JUnit-free) CLI is in progress (handy for e.g. Clojure or other
languages that don't use JUnit)
* It will be a lot faster
* Not a single line of Ruby and no JRuby

There are no docs yet, that will come later. I'm looking for people
who have some small to medium sized Cuke4Duke projects who would like
to try switching over. This will expose what the missing features are,
what needs to be documented etc.

Cucumber-JVM is currently not released anywhere, so you'll have to
build it yourself: https://github.com/cucumber/cucumber-jvm

For those who try - don't expect everything to work. I do need your
help testing it out to make it stabilise faster and get the features
it needs. I'll be here answering any questions you might have. I'm
*very* excited about this project! And we need contributors! Show the
Ruby community that the Java/Groovy/Clojure/Scala people can
contribute to open source too!

Cheers,
Aslak

Alan Wostenberg

unread,
Aug 18, 2011, 11:47:01 AM8/18/11
to cu...@googlegroups.com

Aslak, this is great news and I'll give this a whirl immediately with our existing cuke4duke tests.


However as of August 16th, the "gem install cuke4duke" stopped working, as described in thread "trouble installing gherkin gem" (log at https://gist.github.com/1152852).  Would you be willing to invest a little time in it? 


Meanwhile I'll jump right on this  Cucumber-jvm, since the old cuke4duke no longer works on our continuous integration servers.


-Alan Wostenberg

aslak hellesoy

unread,
Aug 18, 2011, 11:57:48 AM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 4:47 PM, Alan Wostenberg <awo...@gmail.com> wrote:
> Aslak, this is great news and I'll give this a whirl immediately with our
> existing cuke4duke tests.
>
> However as of August 16th, the "gem install cuke4duke" stopped working, as
> described in thread "trouble installing gherkin gem" (log at
> https://gist.github.com/1152852).  Would you be willing to invest a little
> time in it?
>

That problem should be fixed if you install gherkin-2.4.11
(2.4.7-2.4.10 were all broken due to a rubygems/yaml bug and it took
me several releases to figure out how to work around it).

> Meanwhile I'll jump right on this  Cucumber-jvm, since the old cuke4duke no
> longer works on our continuous integration servers.
>

Great! Looking forward to hearing what your first stumble is so I can
start documenting and improving it :-)

Aslak

> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cukes/-/wkXdhAXqZs4J.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cukes?hl=en.
>

Alan Wostenberg

unread,
Aug 18, 2011, 12:18:05 PM8/18/11
to cu...@googlegroups.com


On Thursday, August 18, 2011 9:57:48 AM UTC-6, Aslak Hellesøy wrote:
On Thu, Aug 18, 2011 at 4:47 PM, Alan Wostenberg <awo...@gmail.com> wrote:
> Aslak, this is great news and I'll give this a whirl immediately with our
> existing cuke4duke tests.
>
> However as of August 16th, the "gem install cuke4duke" stopped working, as
> described in thread "trouble installing gherkin gem" (log at
> https://gist.github.com/1152852).  Would you be willing to invest a little
> time in it?
>

That problem should be fixed if you install gherkin-2.4.11
(2.4.7-2.4.10 were all broken due to a rubygems/yaml bug and it took
me several releases to figure out how to work around it).

Yes, but notice the log (https://gist.github.com/1152852) shows that latest gherkin
Successfully installed gherkin-2.4.11-java

So it seems there is still something amis installing cuke4duke.  Others report this here http://www.ruby-forum.com/topic/2380026.

I'll switch to Cucumber-jvm today.

aslak hellesoy

unread,
Aug 18, 2011, 12:38:51 PM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 5:18 PM, Alan Wostenberg <awo...@gmail.com> wrote:
>
>
> On Thursday, August 18, 2011 9:57:48 AM UTC-6, Aslak Hellesøy wrote:
>>
>> On Thu, Aug 18, 2011 at 4:47 PM, Alan Wostenberg <awo...@gmail.com> wrote:
>> > Aslak, this is great news and I'll give this a whirl immediately with
>> > our
>> > existing cuke4duke tests.
>> >
>> > However as of August 16th, the "gem install cuke4duke" stopped working,
>> > as
>> > described in thread "trouble installing gherkin gem" (log at
>> > https://gist.github.com/1152852).  Would you be willing to invest a
>> > little
>> > time in it?
>> >
>>
>> That problem should be fixed if you install gherkin-2.4.11
>> (2.4.7-2.4.10 were all broken due to a rubygems/yaml bug and it took
>> me several releases to figure out how to work around it).
>
> Yes, but notice the log (https://gist.github.com/1152852) shows that latest
> gherkin
> Successfully installed gherkin-2.4.11-java

Try completely removing uninstalling any previously installed (broken)
gherkin gems.

> So it seems there is still something amis installing cuke4duke.  Others
> report this here http://www.ruby-forum.com/topic/2380026.
> I'll switch to Cucumber-jvm today.

If by "switch" you mean "try", go ahead. Expect some early adopter pain.

Aslak

> https://groups.google.com/d/msg/cukes/-/pfN55Jp-cOcJ.

lache...@gmail.com

unread,
Aug 18, 2011, 12:48:47 PM8/18/11
to cu...@googlegroups.com
My pom.xml has:
            <gem>install gherkin --version 2.4.11</gem>
            <gem>install cuke4duke --debug --verbose --backtrace</gem>

So I first install the latest gherkin gem, then cuke4duke

I delete my maven repository, and run
mvn -Dcucumber.installGems=true cuke4duke:cucumber

and get these errors :
[INFO] Successfully installed json-1.5.3-java
[INFO] Successfully installed gherkin-2.4.11-java
[INFO] 2 gems installed
[INFO] Exception `LoadError' at org/jruby/RubyKernel.java:1038 - no such file to load -- psych
[INFO] Exception `Gem::LoadError' at file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:861 - Could not fin
d RubyGem sources (> 0.0.1)
[INFO]
[INFO] GET http://rubygems.org/latest_specs.4.8.gz
[INFO] 302 Found
[INFO] GET http://production.s3.rubygems.org/latest_specs.4.8.gz
[INFO] 304 Not Modified
[INFO] GET http://rubygems.org/specs.4.8.gz
[INFO] 302 Found
[INFO] GET http://production.s3.rubygems.org/specs.4.8.gz
[INFO] 304 Not Modified
[INFO] ERROR:  While executing gem ... (ArgumentError)
[INFO]     undefined class/module YAML::Syck::DefaultKey
[INFO]  org/jruby/RubyMarshal.java:148:in `load'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/specification.rb:289:in `_load'
[INFO]  org/jruby/RubyMarshal.java:148:in `load'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:130:in `fetch_spec'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:86:in `fetch_with_errors'
[INFO]  org/jruby/RubyArray.java:2336:in `collect'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:85:in `fetch_with_errors'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:108:in `find_gems_with_sour
ces'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:154:in `add_found_dependenc
ies'
[INFO]  org/jruby/RubyArray.java:1603:in `each'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:153:in `add_found_dependenc
ies'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:137:in `gather_dependencies
'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:252:in `install'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:120:in `execute'
[INFO]  org/jruby/RubyArray.java:1603:in `each'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/command.rb:278:in `invoke'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133:in `process_args'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:103:in `run'
[INFO]  file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:63:in `run'
[INFO]  C:/Ruby192/bin/gem:21:in `(root)'
[INFO] Exception `Gem::SystemExitException' at file:/C:/Documents and Settings/xxxx/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/user_interac
tion.rb:328 - Exiting RubyGems with exit_code 1

Konstantinos Papalias

unread,
Aug 18, 2011, 12:54:44 PM8/18/11
to cu...@googlegroups.com
Thank you Aslak for the fix!
Now that it's fixed, don't we need to push the fixed gems into rubygems? 

aslak hellesoy

unread,
Aug 18, 2011, 1:21:54 PM8/18/11
to cu...@googlegroups.com

It's a RubyGems/YAML bug. JRuby 1.6.3 ships with rubygems 1.5.1.
Upgrading rubygems makes it possible to install gherkin:
gem install rubygems-update
gem update --system

The only problem is - this works with a regular jruby installation.
Upgrading the JRuby downloaded by maven? I have no idea.

Ready to take cucumber-jvm for a spin? Cuke4Duke is going nowhere
while ruby land is as buggy as this.

Aslak

> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/cukes/-/KC8kgk17yf4J.

aslak hellesoy

unread,
Aug 18, 2011, 1:24:44 PM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 5:54 PM, Konstantinos Papalias
<pkwnst...@gmail.com> wrote:
> Thank you Aslak for the fix!

What fix?

> Now that it's fixed, don't we need to push the fixed gems into rubygems?
>

What gems?

> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/cukes/-/vY1OVGiOPMIJ.

Alan Wostenberg

unread,
Aug 18, 2011, 1:36:15 PM8/18/11
to cu...@googlegroups.com


On Thursday, August 18, 2011 10:38:51 AM UTC-6, Aslak Hellesøy wrote:
On Thu, Aug 18, 2011 at 5:18 PM, Alan Wostenberg <awo...@gmail.com> wrote:
>
>
> On Thursday, August 18, 2011 9:57:48 AM UTC-6, Aslak Hellesøy wrote:
>>
>> On Thu, Aug 18, 2011 at 4:47 PM, Alan Wostenberg <awo...@gmail.com> wrote:
>> > Aslak, this is great news and I'll give this a whirl immediately with
>> > our
>> > existing cuke4duke tests.
>> >
>> > However as of August 16th, the "gem install cuke4duke" stopped working,
>> > as
>> > described in thread "trouble installing gherkin gem" (log at
>> > https://gist.github.com/1152852).  Would you be willing to invest a
>> > little
>> > time in it?
>> >
>>
>> That problem should be fixed if you install gherkin-2.4.11
>> (2.4.7-2.4.10 were all broken due to a rubygems/yaml bug and it took
>> me several releases to figure out how to work around it).
>
> Yes, but notice the log (https://gist.github.com/1152852) shows that latest
> gherkin
> Successfully installed gherkin-2.4.11-java

Try completely removing uninstalling any previously installed (broken)
gherkin gems.

Yes, tried that. The first line of that gist (https://gist.github.com/1152852 removes all gems. But your idea led me to a solution. The trick is to install cucumber before cuke4duke: 

gem install cucumber

gem install cuke4duke --version 

This works on a clean machine.

Just doing "gem install cuke4duke" fails with the original error.
Problem solved. Thanks.

> So it seems there is still something amis installing cuke4duke.  Others
> report this here http://www.ruby-forum.com/topic/2380026.
> I'll switch to Cucumber-jvm today.

If by "switch" you mean "try", go ahead. Expect some early adopter pain.

 
Understood! Hope to be a contributor.
 

Alan Wostenberg

unread,
Aug 18, 2011, 1:45:12 PM8/18/11
to cu...@googlegroups.com


On Thursday, August 18, 2011 10:48:47 AM UTC-6, Lache...@gmail.com wrote:
My pom.xml has:
            <gem>install gherkin --version 2.4.11</gem>
            <gem>install cuke4duke --debug --verbose --backtrace</gem>

So I first install the latest gherkin gem, then cuke4duke

I delete my maven repository, and run
mvn -Dcucumber.installGems=true cuke4duke:cucumber

I saw that error, too. Looks like we have to install cucumber prior to cuke4duke in maven land. This pom works for me after clearing out maven repository:
            <gem>install cucumber</gem>

            <gem>install cuke4duke --debug --verbose --backtrace</gem>
Note that cuke4duke 0.4.4 pulls in jruby-1.6.1 which is not the one Aslak recommends. But my cukes are back to green with this so it seems to work.

lache...@gmail.com

unread,
Aug 18, 2011, 1:50:16 PM8/18/11
to cu...@googlegroups.com
Thanks Alan! That fixed my issue too.

David Kowis

unread,
Aug 18, 2011, 2:11:28 PM8/18/11
to cu...@googlegroups.com


On Thursday, August 18, 2011 10:01:24 AM UTC-5, Aslak Hellesøy wrote:
TL;DR: Cuke4Duke is dead. Viva Cucumber-JVM.

implementation of Cucumber for a while. It incorporates the good parts


of Cuke4Duke, but not the bad ones (I hope). I think it's good enough
that some people can start playing with it. Here is where it's at:

As some of you may know, I have been working on a pure JVM

* Mostly API compatible with Cuke4Duke
* Gherkin features can remain unchanged
* Step Definitions and Hooks will have to change some import statements
* The Java implementation is tested better than the other JVM
languages like Groovy etc, but they are there too.
* Scala has no support yet, will add that later.
* You can run features with JUnit
* A (JUnit-free) CLI is in progress (handy for e.g. Clojure or other
languages that don't use JUnit)
* It will be a lot faster
* Not a single line of Ruby and no JRuby

So there will not be any more support for Ruby step definitions? That is sad :(
I've got a couple projects that we're wanting to use Ruby step definitions to facilitate the writing of our tests.
 
Thanks,
David

Robert

unread,
Aug 18, 2011, 2:12:13 PM8/18/11
to cu...@googlegroups.com


Aslak,

This is FANTASTIC news!!!  And, it could not have come at a better time for us.  We are currently struggling (have been for a couple of weeks now), to install the latest version of Cuke4Duke on one of our machines -- a clean install. 

Unfortunately, it has just not worked out.  I have an older copy of Cuke4Duke installed on my MacBook Pro, and that version is working just fine.  I'd love to participate in the testing effort... if you don't mind having a small team of QA engineers take the application through its paces.  We use Cuke4Duke heavily and have been looking forward to the pure java implementation. 

Cedric Lamalle

unread,
Aug 18, 2011, 4:08:59 PM8/18/11
to cu...@googlegroups.com
Hi,
Just a few more words about this transition, there is a plan to put cucumber artifacts on Maven Central. With this using Cumcumber-JVM in a maven project will be as simple as adding a dependency in the pom...

I've been a little away ultimately, but I'm still working on the Table implementation. I'm trying to stay as close as possible to the original specification (spec/cucumber/ast/table_spec.rb). I hope to have more time in order to finish it until next week. This part is a little bigger than I initially thought, but I'm not afraid!! For the diff part I've found an LCS implementation based on Myers Algorithm for java[1], I'll see if the results are different in this case from the Hunt–McIlroy algorithm used in Ruby Cucumber.

Bye,
Cédric.

[1] http://code.google.com/p/java-diff-utils/ (Apache Software License v2)
2011/8/18 aslak hellesoy <aslak.h...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Cukes" group.

Dmitriy Korobskiy

unread,
Aug 18, 2011, 4:57:04 PM8/18/11
to cu...@googlegroups.com
On 8/18/11 2:11 PM, David Kowis wrote:
> I've got a couple projects that we're wanting to use Ruby step
> definitions to facilitate the writing of our tests.
What's stopping you from using native cucumber for those?

--
DK
AIM: DKroot1, Skype: DKroot

David Kowis

unread,
Aug 18, 2011, 5:28:07 PM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 3:57 PM, Dmitriy Korobskiy <dkr...@gmail.com> wrote:
> On 8/18/11 2:11 PM, David Kowis wrote:
>>
>> I've got a couple projects that we're wanting to use Ruby step definitions
>> to facilitate the writing of our tests.
>
> What's stopping you from using native cucumber for those?

Sorry, sufficient context failure:

It's a Java project, built using Maven. We're using the
cuke4duke-maven-plugin to fire off cucumber feature tests for it.

We could probably build in something using maven-ant-tasks but it'd be
far uglier.

Thanks,
David

John Lonergan

unread,
Aug 18, 2011, 5:44:28 PM8/18/11
to cu...@googlegroups.com
Hi did a clean install of cuke jvm but got some errors ...

  looksUpInstantiableSubclassesOnClassPath(cucumber.runtime.ClasspathTest)
  looksUpFilesByDir(cucumber.runtime.ClasspathTest)
  looksUpFilesByFile(cucumber.runtime.ClasspathTest)



TEST-cucumber.runtime.ClasspathTest.xml

Dmitriy Korobskiy

unread,
Aug 18, 2011, 5:57:14 PM8/18/11
to cu...@googlegroups.com
On 8/18/11 5:28 PM, David Kowis wrote:
> On Thu, Aug 18, 2011 at 3:57 PM, Dmitriy Korobskiy<dkr...@gmail.com> wrote:
>> On 8/18/11 2:11 PM, David Kowis wrote:
>>> I've got a couple projects that we're wanting to use Ruby step definitions
>>> to facilitate the writing of our tests.
>> What's stopping you from using native cucumber for those?
> Sorry, sufficient context failure:
>
> It's a Java project, built using Maven. We're using the
Got it. Maven... Sigh.

> cuke4duke-maven-plugin to fire off cucumber feature tests for it.
>
> We could probably build in something using maven-ant-tasks but it'd be
> far uglier.
Isn't it well, strange that a simple command like invocation (>cucumber
...) is somehow
problematic to do with Maven? I'm using Ant for build and it's a piece
of cake as it should be.

Rob Hunter

unread,
Aug 18, 2011, 6:09:54 PM8/18/11
to cu...@googlegroups.com

I've not worked with Maven, but it sounds like it would be helpful if there were a pre-built Maven task/target/rule/whatever that runs the plain Ruby Cucumber.

It night even be that this already exists in the cuke4duke Maven plug-in and just needs a little attention drawn to it.

Aslak Hellesøy

unread,
Aug 18, 2011, 7:45:09 PM8/18/11
to cu...@googlegroups.com




On Aug 18, 2011, at 22:44, John Lonergan <john.l...@gmail.com> wrote:

Hi did a clean install of cuke jvm but got some errors ...

  looksUpInstantiableSubclassesOnClassPath(cucumber.runtime.ClasspathTest)
  looksUpFilesByDir(cucumber.runtime.ClasspathTest)
  looksUpFilesByFile(cucumber.runtime.ClasspathTest)



What:

Stack trace?
OS?
Java version?

Aslak
<TEST-cucumber.runtime.ClasspathTest.xml>

Aslak Hellesøy

unread,
Aug 18, 2011, 7:52:53 PM8/18/11
to cu...@googlegroups.com

You want to invoke methods in your Java code using Ruby (via JRuby) in
your step defs?

Please explain what technology your Java project uses (Web? Swing?
What frameworks?)

We could always add JRuby support in Cucumber-JVM, but I need to
understand why this would be preferrable over MRI and Cucumber-Ruby
(alive and kicking)..

I don't understand how the build tool (Ant/Maven) is relevant in this
regard. Please help me understand.

Aslak

> Thanks,
> David

Aslak Hellesøy

unread,
Aug 18, 2011, 7:54:20 PM8/18/11
to cu...@googlegroups.com
On Aug 18, 2011, at 23:09, Rob Hunter <robert...@gmail.com> wrote:

> Am 19/08/2011 um 7:57 AM schrieb Dmitriy Korobskiy <dkr...@gmail.com>:
>
>> On 8/18/11 5:28 PM, David Kowis wrote:
>>> On Thu, Aug 18, 2011 at 3:57 PM, Dmitriy Korobskiy<dkr...@gmail.com> wrote:
>>>> On 8/18/11 2:11 PM, David Kowis wrote:
>>>>> I've got a couple projects that we're wanting to use Ruby step definitions
>>>>> to facilitate the writing of our tests.
>>>> What's stopping you from using native cucumber for those?
>>> Sorry, sufficient context failure:
>>>
>>> It's a Java project, built using Maven. We're using the
>> Got it. Maven... Sigh.
>>> cuke4duke-maven-plugin to fire off cucumber feature tests for it.
>>>
>>> We could probably build in something using maven-ant-tasks but it'd be
>>> far uglier.
>> Isn't it well, strange that a simple command like invocation (>cucumber ...) is somehow
>> problematic to do with Maven? I'm using Ant for build and it's a piece of cake as it should be.
>>
>
> I've not worked with Maven, but it sounds like it would be helpful if there were a pre-built Maven task/target/rule/whatever that runs the plain Ruby Cucumber.
>

Can you give an example of a technology stack where you think this
would be helpful?

Aslak

> It night even be that this already exists in the cuke4duke Maven plug-in and just needs a little attention drawn to it.
>

arti.p...@gmail.com

unread,
Aug 18, 2011, 8:53:39 PM8/18/11
to cu...@googlegroups.com
Aslak,
I will start using cucumber jvm.I tried building it last week, but I was getting many errors. Could have been pbkc errors, I admit as this is my third week with java/maven.
Can I use a fit style table structure with cucumber jvm...is there a capybara equivalent.
Arti
Sent from my BlackBerry device on the Rogers Wireless Network

David Kowis

unread,
Aug 18, 2011, 10:17:54 PM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 5:09 PM, Rob Hunter <robert...@gmail.com> wrote:
>>> We could probably build in something using maven-ant-tasks but it'd be
>>> far uglier.
>> Isn't it well, strange that a simple command like invocation (>cucumber ...) is somehow
>> problematic to do with Maven? I'm using Ant for build and it's a piece of cake as it should be.
>>
>
> I've not worked with Maven, but it sounds like it would be helpful if there were a pre-built Maven task/target/rule/whatever that runs the plain Ruby Cucumber.
>
> It night even be that this already exists in the cuke4duke Maven plug-in and just needs a little attention drawn to it.

Perhaps, if you have an external Jruby, the cuke4duke-maven-plugin
wraps it all in, as it should be, so it's very convienient and
relatively easy to use.

(When rubygems isn't horking everything up.)

David

David Kowis

unread,
Aug 18, 2011, 10:29:02 PM8/18/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 6:52 PM, Aslak Hellesøy
<aslak.h...@gmail.com> wrote:
> On Aug 18, 2011, at 22:28, David Kowis <dko...@gmail.com> wrote:
>
>> On Thu, Aug 18, 2011 at 3:57 PM, Dmitriy Korobskiy <dkr...@gmail.com> wrote:
>>> On 8/18/11 2:11 PM, David Kowis wrote:
>>>>
>>>> I've got a couple projects that we're wanting to use Ruby step definitions
>>>> to facilitate the writing of our tests.
>>>
>>> What's stopping you from using native cucumber for those?
>>
>> Sorry, sufficient context failure:
>>
>> It's a Java project, built using Maven. We're using the
>> cuke4duke-maven-plugin to fire off cucumber feature tests for it.
>>
>> We could probably build in something using maven-ant-tasks but it'd be
>> far uglier.
>>
>
> You want to invoke methods in your Java code using Ruby (via JRuby) in
> your step defs?

Yep. Same as if you're using scala or groovy. It'd be nice if we could
use other ruby gems as well, but I was going to cross that bridge when
I came to it.

>
> Please explain what technology your Java project uses (Web? Swing?
> What frameworks?)

Spring. Hibernate. Jersey. It's a web service. Deployed in glassfish,
but for testing just running in Jetty.

>
> We could always add JRuby support in Cucumber-JVM, but I need to
> understand why this would be preferrable over MRI and Cucumber-Ruby
> (alive and kicking)..
>
> I don't understand how the build tool (Ant/Maven) is relevant in this
> regard. Please help me understand.

Maybe then I don't completely understand how it works.

Cuke4Duke handles running cucumber, and jruby and everything.
As well as enabling step definitions in other languages.
The cuke4duke-maven-plugin also integrates it nicely with maven so
that we can just have it run as part of our integration test.
It doesn't require having an installation of Ruby (JRuby or otherwise)
on the system, which makes it easier to deal with Continuous
Integration servers.

The build tool stuff is mostly for context, we liked being able to
easily add in the ability to run cucumber features to our projects.
And our testers, as well as some of the developers, really like being
able to write the step definitions in ruby. We're using maven for all
of our java projects, potentially moving to Gradle at some point in
the future.

Is there a different way to do this easier that I've completely missed
out on? Hopefully I've made myself more clear. I guess I thought that
cucumber-jvm would basically be just like the existing way we're using
cuke4duke, but instead of calling out to ruby to run the cucumber
features, it'd just do it in native java.

Thanks,
David

aslak hellesoy

unread,
Aug 19, 2011, 3:41:58 AM8/19/11
to cu...@googlegroups.com
On Fri, Aug 19, 2011 at 3:29 AM, David Kowis <dko...@gmail.com> wrote:
> On Thu, Aug 18, 2011 at 6:52 PM, Aslak Hellesøy
> <aslak.h...@gmail.com> wrote:
>> On Aug 18, 2011, at 22:28, David Kowis <dko...@gmail.com> wrote:
>>
>>> On Thu, Aug 18, 2011 at 3:57 PM, Dmitriy Korobskiy <dkr...@gmail.com> wrote:
>>>> On 8/18/11 2:11 PM, David Kowis wrote:
>>>>>
>>>>> I've got a couple projects that we're wanting to use Ruby step definitions
>>>>> to facilitate the writing of our tests.
>>>>
>>>> What's stopping you from using native cucumber for those?
>>>
>>> Sorry, sufficient context failure:
>>>
>>> It's a Java project, built using Maven. We're using the
>>> cuke4duke-maven-plugin to fire off cucumber feature tests for it.
>>>
>>> We could probably build in something using maven-ant-tasks but it'd be
>>> far uglier.
>>>
>>
>> You want to invoke methods in your Java code using Ruby (via JRuby) in
>> your step defs?
>
> Yep. Same as if you're using scala or groovy. It'd be nice if we could
> use other ruby gems as well, but I was going to cross that bridge when
> I came to it.
>

Installing gems "into" a JRuby that is a plain JRuby jar file (and not
a regular zipfile installation) is somewhat tricky, and has been a
constant source of frustration in cuke4duke. It's possible, setting
GEM_HOME and GEM_PATH, but anyone who has worked with environment
variables in Java know that's tricky as well. If someone has a good
recipe for doing this, please share.

We'll probably add JRuby (and Jython) support, in the same vein as the
other JVM languages already supported. Having Maven/Ant/Gradle/your
favourite build tool install gems/eggs is still going to be a little
tricky (see above). Hopefulley someone will contribute some nice
recipes for the cucumber-jvm wiki here...

aslak hellesoy

unread,
Aug 19, 2011, 5:35:26 AM8/19/11
to cu...@googlegroups.com
On Fri, Aug 19, 2011 at 1:53 AM, <arti.p...@gmail.com> wrote:
> Aslak,
>      I will start using cucumber jvm.I tried building it last week, but I was getting many errors.

We can only fix errors if we know what they are.

> Could have been pbkc errors, I admit as this is my third week with java/maven.
> Can I use a fit style table structure with cucumber jvm...

Yes, featuers are still written in Gherkin - that won't change.

> is there a capybara equivalent.

Yes - Selenium

aslak hellesoy

unread,
Aug 19, 2011, 9:03:10 AM8/19/11
to cu...@googlegroups.com
On Thu, Aug 18, 2011 at 9:08 PM, Cedric Lamalle
<cedric....@gmail.com> wrote:
> Hi,
> Just a few more words about this transition, there is a plan to put cucumber
> artifacts on Maven Central. With this using Cumcumber-JVM in a maven project
> will be as simple as adding a dependency in the pom...
>
> I've been a little away ultimately, but I'm still working on the Table
> implementation. I'm trying to stay as close as possible to the original
> specification (spec/cucumber/ast/table_spec.rb).

That's awesome Cedric. Let's take the time to discuss what we
like/dislike from Cucumber Ruby's (crb) table diffing so we can make
it even better.

Crb's diff attempts to do a diff of rows as well as columns. In
practice I have never found a need for column diffing, so I'm open for
removing that if it simplifies the implementation.
Another thing Crb's diff does is to require the presence of a header
row. This row is used to reorder columns in case we're comparing with
a table of hashes. This is a little too clever as well, and I'd like
to remove that too. So here are the changes I propose:

* No header row required (and now reordering of columns before diffing)
* No column diffing

Does anyone see any problems with this?

> I hope to have more time in
> order to finish it until next week. This part is a little bigger than I
> initially thought, but I'm not afraid!! For the diff part I've found an LCS
> implementation based on Myers Algorithm for java[1], I'll see if the results
> are different in this case from the Hunt–McIlroy algorithm used in Ruby
> Cucumber.
>

If you don't have any luck with Myers, it should be fairly easy to
port the code from
https://github.com/halostatue/diff-lcs/blob/master/lib/diff/lcs.rb
There is a very short Diff LCS implementation here:
http://introcs.cs.princeton.edu/java/96optimization/ - haven't studied
it, so I don't know if it's the same algo (Hunt–McIlroy)

Aslak

Cedric Lamalle

unread,
Aug 21, 2011, 9:10:01 AM8/21/11
to cu...@googlegroups.com


2011/8/19 aslak hellesoy <aslak.h...@gmail.com>

On Thu, Aug 18, 2011 at 9:08 PM, Cedric Lamalle
<cedric....@gmail.com> wrote:
> Hi,
> Just a few more words about this transition, there is a plan to put cucumber
> artifacts on Maven Central. With this using Cumcumber-JVM in a maven project
> will be as simple as adding a dependency in the pom...
>
> I've been a little away ultimately, but I'm still working on the Table
> implementation. I'm trying to stay as close as possible to the original
> specification (spec/cucumber/ast/table_spec.rb).

That's awesome Cedric. Let's take the time to discuss what we
like/dislike from Cucumber Ruby's (crb) table diffing so we can make
it even better. 

Crb's diff attempts to do a diff of rows as well as columns. In
practice I have never found a need for column diffing, so I'm open for
removing that if it simplifies the implementation.
Another thing Crb's diff does is to require the presence of a header
row. This row is used to reorder columns in case we're comparing with
a table of hashes. This is a little too clever as well, and I'd like
to remove that too. So here are the changes I propose:

* No header row required (and now reordering of columns before diffing)
* No column diffing

I agree with this. The headers were useful to be sure to compare the same column even if it wasn't in the same position.
How did you imagine this? Something like that:
Given the following table:
  | name  | email           | phone |
  | Aslak | as...@email.com | 123   |
  | Joe   | j...@email.com   | 234   |
  | Bryan | br...@email.org | 456   |
  | Ni    | n...@email.com    | 654   |
When diffing it with the following table:
  | name  | email                | phone |
  | Aslak | as...@mel.com        | 123   |
  | Doe   | j...@email.com        | 234   |
  | Foo   | schni...@email.net | 789   |
  | Bryan | br...@email.org      | 456   |
Then the resulting diff should be:
     | name            | email                                 | phone |
  (~)| Aslak           | (-)as...@email.com (+)as...@mel.com   | 123   |
  (~)| (-)Joe (+)Doe   | j...@email.com                         | 234   |
  (+)| Foo             | schni...@emil.net                   | 789   |
     | Bryan           | br...@email.org                       | 456   |
  (-)| Ni              | n...@email.com                          | 654   |

Does anyone see any problems with this?

> I hope to have more time in
> order to finish it until next week. This part is a little bigger than I
> initially thought, but I'm not afraid!! For the diff part I've found an LCS
> implementation based on Myers Algorithm for java[1], I'll see if the results
> are different in this case from the Hunt–McIlroy algorithm used in Ruby
> Cucumber.
>

If you don't have any luck with Myers, it should be fairly easy to
port the code from
https://github.com/halostatue/diff-lcs/blob/master/lib/diff/lcs.rb
There is a very short Diff LCS implementation here:
http://introcs.cs.princeton.edu/java/96optimization/ - haven't studied
it, so I don't know if it's the same algo (Hunt–McIlroy)

From the tests I've done Myers' algorithm in java-diff-utils works well.

Cedric.

Bill Ross

unread,
Aug 21, 2011, 3:43:34 PM8/21/11
to cu...@googlegroups.com
> Then the resulting diff should be:
> | name | email | phone |
> (~)| Aslak | (-)as...@email.com (+)as...@mel.com | 123 |
> (~)| (-)Joe (+)Doe | j...@email.com | 234 |
> (+)| Foo | schni...@emil.net | 789 |
> | Bryan | br...@email.org | 456 |
> (-)| Ni | n...@email.com | 654 |
>
> Does anyone see any problems with this?

Parsing longer cell diffs might call for an eye-friendly cell-by-cell
format option. A stab at this:

| name
| email
| phone |
(~)| Aslak

| (-)as...@email.longwinded_alternate_that_wraps_80_chars_by_dint_of_corporate_necessity.com
(+)as...@mel.com
| 123 |

Bill

aslak hellesoy

unread,
Aug 21, 2011, 6:11:01 PM8/21/11
to cu...@googlegroups.com
Correct. Let me give you the background. At some point I realised that ActiveRecord could be viewed as an array of Hashes - [{},{}]
You can use this to create a bunch of records with MyRecord.create!(table.hashes), and that was why I added the #hashes method.

Likewise, you can do a query to turn a bunch of AR objects into [{},{}] : MyRecord.find(...).map(&:attributes)
This led me to implement diff so that you could pass a [{},{}] to diff against. This required a top header so that the [{},{}] could be turned into [[],[], []], using the keys as headers, and sorting them according to the original table.

This was a bad decision on my part. It complicates the diff implementation considerably, and for a bad reason. It would be much better to have an external method, say SomeUtil.to_array([{},{}], :foo, :bar, :zap) to turn this into an array of arrays.


> How did you imagine this? Something like that:
> Given the following table:
>   | name  | email           | phone |
>   | Aslak | as...@email.com | 123   |
>   | Joe   | j...@email.com   | 234   |
>   | Bryan | br...@email.org | 456   |
>   | Ni    | n...@email.com    | 654   |
> When diffing it with the following table:
>   | name  | email                | phone |
>   | Aslak | as...@mel.com        | 123   |
>   | Doe   | j...@email.com        | 234   |
>   | Foo   | schni...@email.net | 789   |
>   | Bryan | br...@email.org      | 456   |
> Then the resulting diff should be:
>      | name            | email                                 | phone |
>   (~)| Aslak           | (-)as...@email.com (+)as...@mel.com   | 123   |
>   (~)| (-)Joe (+)Doe   | j...@email.com                         | 234   |
>   (+)| Foo             | schni...@emil.net                   | 789   |
>      | Bryan           | br...@email.org                       | 456   |
>   (-)| Ni              | n...@email.com                          | 654   |

Something like that. One important detail is that the header row would not be required. Also, when two rows are different I don't think we have to look for individual cell differences - just list the rows as different:

  | name  | email               | phone |
  | Aslak | as...@email.com     | 123   |
- | Joe   | j...@email.com       | 234   |
+ | Joe   | j...@email.com       | 234   |
+ | Foo   | shchi...@emil.net | 789   |
  | Bryan | br...@email.org     | 456   |
- | Ni    | n...@email.com        | 654   |


WDYT?

Aslak

Cedric Lamalle

unread,
Aug 22, 2011, 8:26:55 AM8/22/11
to cu...@googlegroups.com


2011/8/21 aslak hellesoy <aslak.h...@gmail.com>
I have used the hashes method in a TableTransformer to transform each line in a JavaBean in a similiar way. What do you think about this? I think it will be helpful in particular in background and given steps.
 
Likewise, you can do a query to turn a bunch of AR objects into [{},{}] : MyRecord.find(...).map(&:attributes)
This led me to implement diff so that you could pass a [{},{}] to diff against. This required a top header so that the [{},{}] could be turned into [[],[], []], using the keys as headers, and sorting them according to the original table.

This was a bad decision on my part. It complicates the diff implementation considerably, and for a bad reason. It would be much better to have an external method, say SomeUtil.to_array([{},{}], :foo, :bar, :zap) to turn this into an array of arrays.

I was planning to create a TableDiffer class. One candidate for the Diff would be raw()  that returns List<LIst<String>> to do the diff. But it would be better to use the mapped column, ie 1.000 is different of 1000 if compared as a String, but I don't think this should be reported as a problem if the column was mapped as an integer. What do you think about this? I'll make a little modification in the code to allow mapping column to transformers by position, besides the current one that maps using the headers.
That way the implementation will be simpler and what's really important is to know that the lines didn't match.

Mark Derricutt

unread,
Aug 22, 2011, 9:06:51 PM8/22/11
to cu...@googlegroups.com
Just commenting on an old email here - in my fork of cucumber-jvm (nothing pushed yet) I have the start of a maven-surefire provider which will invoke cucumber-jvm without any Junit tests (hopefully) just by discovering .feature files in your target class path.

I have the basics working and am just diving into how the Junit runner actually runs cucumber.

Cedric Lamalle

unread,
Aug 23, 2011, 12:25:40 AM8/23/11
to cu...@googlegroups.com


2011/8/21 aslak hellesoy <aslak.h...@gmail.com>
I have implemented the table diffing as we discussed it above. I still need to get rid of the header when calling rows(). I didn't find a way to know if a table as header, so I think I'll add a rows() method with a boolean parameter 'hasHeader', if this boolean is true rows() will skip the first line (it's an header), else it will return all rows (transformed).
I'll have to merge master to make integration easier.
Cheers,
Cédric.

Urs

unread,
Aug 23, 2011, 7:33:10 AM8/23/11
to Cukes
Aslak,
this is great news.

I just gave it a whirl, and got up to the point where I try to run a
feature.
Afterwards it's
cucumber.runtime.CucumberException: Failed to scan jar[1]
Caused by: java.io.FileNotFoundException: C:\Dokumente%20und
%20Einstellungen\ur\.m2\repository\info\cukes\cucumber-java\1.0.0-
SNAPSHOT\cucumber-java-1.0.0-SNAPSHOT.jar,
but the file is definitely there.

I'm launching the test via IntelliJ IDEA 10.5.1 on WinXP, the
repository is a Maven3 repo.

Could you guess what I need to do to get this running?
Out of curiosity, why would Cucumber even need to scan its own .jar
file?

Regards
-Urs

[1]Full Stacktrace:
cucumber.runtime.CucumberException: Failed to scan jar
at cucumber.classpath.Classpath.scanJar(Classpath.java:134)
at cucumber.classpath.Classpath.scan(Classpath.java:54)
at cucumber.classpath.Classpath.getInstantiableClasses(Classpath.java:
35)
at
cucumber.classpath.Classpath.getInstantiableSubclassesOf(Classpath.java:
41)
at cucumber.classpath.Classpath.instantiateSubclasses(Classpath.java:
98)
at cucumber.runtime.Runtime.<init>(Runtime.java:25)
at cucumber.junit.Cucumber.runtime(Cucumber.java:29)
at cucumber.junit.Cucumber.<init>(Cucumber.java:43)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:
31)
at
org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:
24)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:
57)
at
org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:
29)
at
org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:
57)
at
org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:
24)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
62)
Caused by: java.io.FileNotFoundException: C:\Dokumente%20und
%20Einstellungen\ur\.m2\repository\info\cukes\cucumber-java\1.0.0-
SNAPSHOT\cucumber-java-1.0.0-SNAPSHOT.jar (Das System kann den
angegebenen Pfad nicht finden)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
at java.util.zip.ZipFile.<init>(ZipFile.java:88)
at cucumber.classpath.Classpath.scanJar(Classpath.java:124)
... 20 more

aslak hellesoy

unread,
Aug 23, 2011, 8:53:08 AM8/23/11
to cu...@googlegroups.com
On Tue, Aug 23, 2011 at 12:33 PM, Urs <ursr...@googlemail.com> wrote:
Aslak,
this is great news.

I just gave it a whirl,

Does this mean you have successfully run mvn install?
 
and got up to the point where I try to run a
feature.
Afterwards it's
cucumber.runtime.CucumberException: Failed to scan jar[1]
Caused by: java.io.FileNotFoundException: C:\Dokumente%20und
%20Einstellungen\ur\.m2\repository\info\cukes\cucumber-java\1.0.0-
SNAPSHOT\cucumber-java-1.0.0-SNAPSHOT.jar,
but the file is definitely there.

Sounds like a Java-on-Windows bug that we need to add a workaround for. Spaces in file names is a common source of bugs on Windows. It would be great if you could help with a fix.
 

I'm launching the test via IntelliJ IDEA 10.5.1 on WinXP, the
repository is a Maven3 repo.

Could you guess what I need to do to get this running?

Start by adding a new test to ClassPathTest that exposes the space-in-path bug. When you have something that works, commit and send a pull request.
 
Out of curiosity, why would Cucumber even need to scan its own .jar
file?


Cucumber-JVM isn't one jar file, but many. Any project will use a subset of them, depending on the programming language at use. Cucumber-Core scans the classpath for an implementation of Backend, and expects to find exactly one (GroovyBackend, JavaBackend, JRubyBackend, ClojureBackend, ScalaBackend etc). We could have forced users to explicitly tell Cucumber what backend to use (with a --backend CLI switch, an annotation on your JUnit classes or maybe a config file or a system property). That would just makes life a little harder for users, so I decided to make this more intelligent.

The same scanning logic is used to discover Java step definitions and load feature files from the classpath or filesystem. If there is a bug with spaces it needs to be fixed. I have created a bug here (up for grabs): https://github.com/cucumber/cucumber-jvm/issues/17

Aslak


--

Urs Reupke

unread,
Aug 23, 2011, 9:08:19 AM8/23/11
to cu...@googlegroups.com
Hey Aslak,

Does this mean you have successfully run mvn install?
That's what I meant, I have run 'mvn install' successfully and have also added the dependency to my existing project, exchanged the annotations and created a test class.

Sounds like a Java-on-Windows bug that we need to add a workaround for. Spaces in file names is a common source of bugs on Windows. It would be great if you could help with a fix.
Figured as much. I made some experiments earlier, but unfortunately it's not as simple as I had hoped.
I'll spend some more time with it later. 

Regards
-Urs

aslak hellesoy

unread,
Aug 23, 2011, 7:34:46 PM8/23/11
to cu...@googlegroups.com
Awesome job Cédric!

I have merged the code to master and pushed. I simplified it a little to take advantage of some small changes I made in a new Gherkin release:

I think it is important to be able to diff two tables without having a header row. I'm not sure I see the value in diffing rows with converted objects - I think diffing on the String level would be sufficient.

Diffing with converted objects could in theory be useful for something like this:

  List<Person> people = ...;
  Table actual = new Table(people);
  table.diff(actual)

However, I don't think that will be a common use case. You might as well do:

  List<Person> people = ...;
  Table peopleTable = toTable(people, table.getLocale()); // This could be a static utility method that uses reflection to create List<List<String>> internally.
  table.diff(actual)

Most uses of table diffing I have seen compares data from a web page, where everything is strings anyway, extracted from Selenium's DOM.

Unless I'm missing why diffing on converted objects is important I think we should consider simplifying the diffing logic to work only on strings. What do you think?

I love the code that turns rows into a list of beans! It would if it could also set public fields (without getters or setters) as well as invoking constructors (using the same argument order as the table), but that's something we can add later.

Aslak

Cedric Lamalle

unread,
Aug 23, 2011, 11:04:06 PM8/23/11
to cu...@googlegroups.com


2011/8/23 aslak hellesoy <aslak.h...@gmail.com>
Diffing table without headers is the next item on my list.
 
Diffing with converted objects could in theory be useful for something like this:

  List<Person> people = ...;
  Table actual = new Table(people);
  table.diff(actual)

However, I don't think that will be a common use case. You might as well do:

  List<Person> people = ...;
  Table peopleTable = toTable(people, table.getLocale()); // This could be a static utility method that uses reflection to create List<List<String>> internally.
  table.diff(actual)

Most uses of table diffing I have seen compares data from a web page, where everything is strings anyway, extracted from Selenium's DOM.

Unless I'm missing why diffing on converted objects is important I think we should consider simplifying the diffing logic to work only on strings. What do you think?
The idea was, as you stated above, to be able to compare with an expected list of object. That way it will be possible to format the resulting diff, instead of an assertEquals(expectedList, actualList) which doesn't show where are the differences. Maybe this won't be as useful as I thought.
 
I love the code that turns rows into a list of beans! It would if it could also set public fields (without getters or setters) as well as invoking constructors (using the same argument order as the table), but that's something we can add later.
Glad to know you like this part. I've seen your comment about passing list of beans and created a feature request: https://github.com/cucumber/cucumber-jvm/issues/19. This will be very handy.

Cédric.

aslak hellesoy

unread,
Aug 24, 2011, 3:37:55 AM8/24/11
to cu...@googlegroups.com
Do you mean support both with and without headers? -Or always ignore headers. (I hope the latter). IMO headers should only be used for bean conversion - not for diffing.
 
 
Diffing with converted objects could in theory be useful for something like this:

  List<Person> people = ...;
  Table actual = new Table(people);
  table.diff(actual)

However, I don't think that will be a common use case. You might as well do:

  List<Person> people = ...;
  Table peopleTable = toTable(people, table.getLocale()); // This could be a static utility method that uses reflection to create List<List<String>> internally.
  table.diff(actual)

Most uses of table diffing I have seen compares data from a web page, where everything is strings anyway, extracted from Selenium's DOM.

Unless I'm missing why diffing on converted objects is important I think we should consider simplifying the diffing logic to work only on strings. What do you think?
The idea was, as you stated above, to be able to compare with an expected list of object. That way it will be possible to format the resulting diff, instead of an assertEquals(expectedList, actualList) which doesn't show where are the differences. Maybe this won't be as useful as I thought.

Gherkin's Pretty formatter knows how to do this now:


We can tweak it a little so that the diff is a String that is part of the DiffException. That way it would show up when using JUnit (no pretty formatter) too.

Christian Gleissner

unread,
Nov 10, 2011, 12:55:13 PM11/10/11
to cu...@googlegroups.com
Cucumber-JVM's JUnit integration breaks when run in parallel mode using Maven 3, JUnit 4.10 and Surefire 2.10.  In our set-up, we are using the parallel=classes and 4 threads. When the Cucumber JUnit runner starts, it discovers that there are no step definitions for feature files. This only occurs when running in parallel. The sequential run is fine.

Looking at the Cucumber runner, I noticed the following static fields:

public class Cucumber extends Suite {

    private static final Runtime runtime = new Runtime();

    private static JUnitReporter jUnitReporter;

I started patching this class by turning the above fields into thread-local fields, but that didn't yet resolve the issue. Are there any plans to get Cucumber-JVM to work in a concurrent test scenario?


aslak hellesoy

unread,
Nov 10, 2011, 1:23:57 PM11/10/11
to cu...@googlegroups.com

There are currently no plans, but it would obviously be great if it
worked. I have created an issue for this:
https://github.com/cucumber/cucumber-jvm/issues/86

I'm currently focussed on Milestone-1:
https://github.com/cucumber/cucumber-jvm/issues?milestone=1&state=open

Aslak

> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/cukes/-/aoQqL1sOrRIJ.

Christian Gleissner

unread,
Nov 10, 2011, 1:39:37 PM11/10/11
to cu...@googlegroups.com
Hi Aslak,

thanks for your reply.

I created a little test project which can be used to demonstrate and resolve this issue. One can enable a parallel test by activating a Maven profile on this project. 

Would you like me to attach a ZIP of this Maven 3 project to the issue you created?

Thanks
Christian

aslak hellesoy

unread,
Nov 10, 2011, 1:48:28 PM11/10/11
to cu...@googlegroups.com

It would be better if you could fork cucumber-jvm, clone it, create a
branch called parallel and add it under examples. Then push to your
fork. Zip files are too hard to deal with. Having it all in git is
better. In case you're new to git:

* press the fork button
* git clone ..your fork url..
* cd cucumber-jvm
* git checkout -b parallel
* Put your code under examples
* git add .
* git commit -m "Example to demonstrate parallel is broken"
* git push

Aslak

> Thanks
> Christian


>
> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/cukes/-/yTFYxVeB1A4J.

biswajit panda

unread,
May 9, 2012, 8:58:42 AM5/9/12
to cu...@googlegroups.com
Is Cucumber - JVM fully developed now???If yes then plz provide some documentations and will it support TestNG?

Thnx in Advance

> cukes+unsubscribe@googlegroups.com.

Thomas Sundberg

unread,
May 9, 2012, 10:15:48 AM5/9/12
to cu...@googlegroups.com
On Wed, May 9, 2012 at 2:58 PM, biswajit panda <biswaj...@gmail.com> wrote:
> Is Cucumber - JVM fully developed now???If yes then plz provide some
> documentations and will it support TestNG?

Cucumber-jvm is released. Documentation will be available when it is
done. Cucumber is an open source project and as all open source
projects, it depends on people developing it on their spare time. I
assume that support for TestNG is available if you use the command
line runner.

There are examples available at Github, https://github.com/cucumber/cucumber-jvm

Happy Cuking!
Thomas
>> > cukes+un...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/cukes?hl=en.
>> >
>
> -- 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 cu...@googlegroups.com. To
> unsubscribe from this group, send email to
> cukes+un...@googlegroups.com. For more options, visit this group at
> https://groups.google.com/d/forum/cukes?hl=en



--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

biswajit panda

unread,
May 10, 2012, 1:31:01 AM5/10/12
to cu...@googlegroups.com
thanx
>> > cukes+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/cukes?hl=en.
>> >
>
> -- 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 cu...@googlegroups.com. To
> unsubscribe from this group, send email to
> cukes+unsubscribe@googlegroups.com. For more options, visit this group at

biswajit panda

unread,
May 10, 2012, 1:42:25 AM5/10/12
to cu...@googlegroups.com
How to set up cucumber-jvm in eclipse in order to run it from the IDE ? Please guide me through this.

Thanx in advance


On Friday, 11 November 2011 00:18:28 UTC+5:30, Aslak Hellesøy wrote:

> cukes+unsubscribe@googlegroups.com.

Richard Paul

unread,
May 10, 2012, 5:25:05 AM5/10/12
to cu...@googlegroups.com
Biswajit,

You can annotate a basic java class to tie the Cucumber features into a JUnit runner in Eclipse: https://github.com/cucumber/cucumber-jvm/blob/master/examples/java-calculator/src/test/java/cucumber/examples/java/calculator/RunCukesTest.java

Hope that helps,
Richard

biswajit panda

unread,
May 10, 2012, 6:56:45 AM5/10/12
to cu...@googlegroups.com
thnx very much

biswajit panda

unread,
May 10, 2012, 6:57:35 AM5/10/12
to cu...@googlegroups.com
Do you know how to use cucumber in testNG??

> cukes+unsubscribe@googlegroups.com.

biswajit panda

unread,
May 16, 2012, 11:57:10 AM5/16/12
to cu...@googlegroups.com
How TestNG can be used in Cucumber JVM.Please help me wit this.

> cukes+unsubscribe@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages