Can you review my Perl rewrite of Cucumber?

假装没事ソ 提交于 2020-01-03 01:58:08

问题


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://cukes.info/


回答1:


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




回答2:


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, :)




回答3:


There's a rather fuller implementation of Cucumber on Perl in the form of Test::BDD::Cucumber.




回答4:


Does Test::A8N fit your requirement?

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



来源:https://stackoverflow.com/questions/642329/can-you-review-my-perl-rewrite-of-cucumber

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!