Running cucumber on jruby under ant
I’ve just spent more time than I expected getting this to work. It seemed like it would be easy, since running cucumber
from the command line is so easy. But ant
is very helpful in sanitizing the environment for subprocesses–a little too helpful, perhaps. After chasing a number of dead ends and increasingly complicated detours, I ended up with this target:
<target name="cucumber" description="Run the cucumber tests"> <property environment="env" /> <exec executable="${jruby.home}/bin/cucumber" > <env key="PATH" path="${jruby.home}/bin:${env.PATH}" /> <env key="CLASSPATH" file="${jruby.home}/lib/jruby.jar" /> </exec> </target>
I hope this helps others.
I’ve been exploring JBehave and saw from their mailing list archive that you were giving up on JBehave and were going to explore cucumber-vm. If you’ve had a chance to look at cucumber-vm, can you compare the two?
David, I gave up on JBehave mostly because I wasn’t interested in Maven. I wouldn’t say I’ve given JBehave, itself, a fair trial. I’ve seen it run under Maven, and that was far too slow in my opinion. It took a long time even when using tags to reduce the run to a single test.
I was never able to run JBehave under Eclipse using the Eclipse JUnit runner. The command-line JUnit runner seems to find the tests, but that seems a bit inconvenient. And by the time I found that difference in the test runners, my time for experimenting with it had passed.
I’ve not yet tried cucumber-jvm, though I’ve been spectating with interest on the Cucumber mailing list. I’m hoping that it will be a faster option, more in tune with the needs of feedback-driven development and less accepting of a stodgy, slow build cycle.