views:

560

answers:

4

There is a team working on acceptance testing X11 GUI application in our company, and they created a monstrous acceptance testing framework that drives the GUI as well as running scenarios.

The framework is written using Perl 5, and scenario files look more like very complex Perl programs (thousands of lines long with procedural-programming style) than acceptance tests.

I recently learned Ruby's Cucumber, and generally have been using Ruby for quite a lot of time. But unfortunately I can't just shove Ruby to replace Perl because the people who are writing all of this don't know Ruby and it's quite certain that they wont want "this" kind of interruption.

So to bring Ruby's Cucumber a bit closer to their work, I rewrote it using Perl 5. Unfortunately I am really not a Perl programmer, and would love to get a code review and to hear suggestions from people who both know Perl and Cucumber.

Hi Perl/Cucumber StackOverflow users - please help me create this "open source" attempt to re-create Cucumber for Perl! I would love to hear your comments and will accept any acceptable help.

The minimal source code is here:

http://github.com/kesor/p5-cucumber

Thank you for your attention.

For those not familiar with cucumber - please take just one small moment to take a look at this one small little page: http://wiki.github.com/aslakhellesoy/cucumber

A: 

Is this as much an answer as that was a question?

Phil H
More like a plee for help ... maybe StackOverflow is good for this kind of thing as well. Lets see.
Evgeny
+2  A: 

Does Test::A8N fit your requirement?

If not there are plenty of other Test:: modules on CPAN which may do what you're after.

/I3az/

draegtun
It looks nice, but it is really not cucumber. And I still use the Test:: modules in the code ... just separate the test-code from the actual story (written in plain english language). The test-code can use any framework it wants to actually "test" the conditions.
Evgeny
Test::A8N is based on Ward Cunningham's FIT (http://fit.c2.com/). There are other Test::FIT* modules on CPAN of which Test::FITesque is what Test::A8N is built on top. Cucumber seems a subset of what Test::A8N / FIT can do... so u could use it as basis for p5-cucumber.
draegtun
Actually cucumber is a superset of what FIT could do, because it supports both the table notation of FIT, and the more natural - natural language notation.
Evgeny
I need to look at Cucumber more closely then ;-) Check out Piers Cawley (http://www.bofh.org.uk/) because he recently mentioned that he was thinking of doing "something like cucumber" in Perl recently (http://use.perl.org/~Ovid/journal/38709)
draegtun
+4  A: 

You might get good help on Perlmonks. That site is geared toward this sort of post, whereas Stackoverflow is more about direct and answerable questions.

Good luck, :)

brian d foy
+2  A: 

Can you review my Perl rewrite of Cucumber?

Answer: Yes.

I've read through the github code you posted. It looks pretty good.

I'm curious about the following snippet from Parser::Parser.yp::ERROR. Why did you chose to use "and do {}" over "if( ){ }"? Style? scoping? other?

  exists $parser->YYData->{ERRMSG}
  and do {
    print $parser->YYData->{ERRMSG};
    delete $parser->YYData->{ERRMSG};
    return;
  };

I haven't used cucumber and am still trying to wrap my head around the usage model. How would someone go about verifying/running your calculator example?

If you plan to release your code to CPAN (and you should), then you'll want to bundle this git source into an installable tarball. You'll want to include one of the module installing tools: ExtUtils::MakeMaker, Module::Build, etc. I've recently started using Dist::Zilla, and am really happy with it. It got me over the activation energy of releasing my first cpan module.

20 second tour of Dist::Zilla:

  1. download and install Dist::Zilla and its requirements (there are many, as it's a developer only tool)
  2. create a dist.ini file in the top level of your package ( 'dzil new MyPackage' )
  3. run 'dzil test', 'dzil build', and 'dzil release',to test, (build and test), (build, test and release)

See the Dist::Zilla::Tutorial

spazm
Thanks for the input, as you probably guessed it has been a while since I updated it last. About the usage of the parser, I'm pretty sure I copied it from some example - as I don't really remember why I chose to do it this way.I remember having two branches, master with a very basic parser, and experimental with a more sophisticated one that would allow more features. Running examples is just that, "p5-cucumber example_dir" where the dir holds scenarios + test code.
Evgeny