Re: Cucumber.js update and questions

487 views
Skip to first unread message

aslak hellesoy

unread,
Apr 19, 2011, 7:39:32 PM4/19/11
to Julien Biezemans, Cucumber Users


On Fri, Apr 8, 2011 at 8:11 AM, Julien Biezemans <j...@jbpros.com> wrote:
Hi Aslak,

I hope you're doing well.


Hi Julien, nice to hear from you. I'm cc-ing the cukes list - this is interesting stuff!
 
A little update on my progress on the cucumber javascript port. I've
been quite busy since cukeup! but I took some time to study the
existing ruby's implementation. I started writing some specs and code
for the top-level class. I think I have the basics to get somewhere
quite quickly.

I'm using Jasmine to write those specs, is that okay for you? Maybe
you have another preference ..? I do like it because it has quite a
similar approach to RSpec which just feels right for me.


Sure, Jasmine is fine.
 
Of course I'm counting on cucumber features to have acceptance tests
as soon as it works. I'm still wondering how far we'll be able to use
the existing ruby implementation features. I'm afraid there are too
many implementation details included in those (e.g. command-line
parameters). But I'll get to that later.


You're right - Cucumber's own features aren't quite useable as-is for an implementation in a different programming language, but we can definitely work on them to make it so!
A while ago I started to write some features using Aruba. They live under features. The old ones (using an early version of Aruba, before Aruba became a gem) live under legacy_features. Don't bother with those. 
 
This is it for now. Expect more from me next week or so :)


Well, I have some good news. I just released gherkin 0.3.6 which now ships in the following incarnations:

* Ruby gem (MRI POSIX)
* Ruby gem (MRI Windows with precompiled C extensions)
* Ruby gem (JRuby)
* Pure Java jar file
* .NET .dll
* Node.js npm package (!!!!)

Try this: npm install gherkin
Then try to run this gist: https://gist.github.com/929952

Equipped with a thoroughly tested gherkin for js (using all of the same specs that are used to test the Ruby, C and Java implementations) I think this is a good basis for a pure-javascript cucumber!

Let me know how the brand new gherkin npm package works for you.

Cheers,
Aslak

Cheers,

Julien.

aslak hellesoy

unread,
Apr 19, 2011, 7:50:48 PM4/19/11
to Cucumber Users
Just a follow up while I remember it. Due to node.js' asynchronous nature, we need a way to ensure sequential (and not parallel) execution of stepdefs. I think step defs may have to be written like this:

Given(/I have (\d+) cukes in my belly/, function(cukes, cb) {
  try {
    someAsyncFuncInMyCode(cb);
  } catch {
    cb();
  }
});

Cucumber.js would pass in cb when invoking the stepdef, and the first time it's called, run the next step. The catch is to make sure it still gets called in the event of an exception. A little ugly, but I'm not sure there is a way around it?

Aslak

Cheers,
Aslak

Cheers,

Julien.


Julien Biezemans

unread,
Apr 21, 2011, 11:23:56 AM4/21/11
to cu...@googlegroups.com
Hi Aslak and all cukers,

I can't wait to try the gherkin npm package, that's awesome!

Regarding current cukes' features, decoupling them from the
implementation would be neat. It would make cucumber itself an example
of good practices to follow. Same features for all implementations but
different step definitions. I'd love to do that :)

I'll check the Aruba features and see how it fits.

I'm still mostly offline and away from the keyboard (I.e. on holidays)
now. Charging up. I plan on hacking on cucumber js next week. As I
already said: I can't wait :D

Cheers,

Julien.

> * Ruby gem (JRuby)* Pure Java jar file* .NET .dll* Node.js npm package (!!!!)
> Try this: npm install gherkinThen try to run this gist: https://gist.github.com/929952


>
>
>
> Equipped with a thoroughly tested gherkin for js (using all of the same specs that are used to test the Ruby, C and Java implementations) I think this is a good basis for a pure-javascript cucumber!
>
>
>
> Let me know how the brand new gherkin npm package works for you.
>
> Just a follow up while I remember it. Due to node.js' asynchronous nature, we need a way to ensure sequential (and not parallel) execution of stepdefs. I think step defs may have to be written like this:
>
>
> Given(/I have (\d+) cukes in my belly/, function(cukes, cb) {  try {    someAsyncFuncInMyCode(cb);  } catch {    cb();  }});
>
>
> Cucumber.js would pass in cb when invoking the stepdef, and the first time it's called, run the next step. The catch is to make sure it still gets called in the event of an exception. A little ugly, but I'm not sure there is a way around it?
>
>
> Aslak
> Cheers,Aslak
>
>
>
>
> Cheers,
>
> Julien.
>
>
>
>

> --
> 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 http://groups.google.com/group/cukes?hl=en.
>

--
Julien Biezemans - j...@jbpros.com
JBpro's Interactive - http://www.jbpros.com/
+32 495 60 32 79

Joseph Wilk

unread,
Apr 21, 2011, 12:16:32 PM4/21/11
to cu...@googlegroups.com
Hello Cukers,

I'm running a one off 1/2 day training session on "The Art of Cucumber"
on June 1st in London at Skillsmatters. It is also a chance to see my
upcoming workshops at Agile2011 and Spa2011.
If anyone is interested you can buy a ticket here:
http://theartofcucumber.eventbrite.com/
If you know anyone who wants to get started with Cucumber I would
appreciate you mentioning the event.

Thanks,
--

Joseph Wilk
http://blog.josephwilk.net
http://www.songkick.com
+44 (0)7812 816431

Reply all
Reply to author
Forward
0 new messages