easyb now supports re-running failed behaviors

Posted by: Andrew Glover on 2009-09-10 11:18:00.0

The latest version of easyb (that is, 0.9.6) contains two new features (among others, man):

  • the ability to run behaviors listed in a file via the -f flag
  • capturing any failed behaviors at run time in an output file via the -outfail flag

everyone loves rerun!Thus, given these two features, you can now run a series of behaviors and if any of those behaviors fail, easyb will create a file (the default name if you don’t provide one is failure-files.txt) at the conclusion of the run, which contains a listing of those failed behaviors. Consequently, you can now re-run easyb and pass it this file — accordingly, only the failed behaviors from a previous run will be executed.

For example, imagine you have a suite of behaviors that takes a bit to run — say 10 minutes. If any of those stories (or specifications, for that matter) fail, it becomes somewhat painful to have to re-run the entire suite after making any requisite fixes which address the previously failing behavior. In that case, it oftentimes becomes easier (and much quicker, baby) to just re-run the previously failing bogue behavior (i.e. a few seconds versus 10 minutes). Thus, when executing easyb, say from Ant, you can now set the failureFile property of the easyb like so:

<easyb failureproperty="easyb.fail" failureFile="target/easyb-failures.txt">
....
</easyb>

In this case, I’m running a series of stories and specifications — if anything fails, a new file will be created listing the offending behavior– in my case, the file will be in the target directory and named easyb-failures.txt. The contents of this file are extremely simple — it’s just a listing of fully qualified file paths. Accordingly, if I want to rerun a particular behavior (or behaviors), I can either execute it via the command line via the -f flag like so:

%>java org.easyb.BehaviorRunner -f target/easyb-failures.txt

or via another Ant task like so:

<easyb failureproperty="easyb.fail" inFile="target/easyb-failures.txt">
....
</easyb>

With re-running only a subset of a behavior suite (i.e. just the ones that failed) easyb just got a bit easier, don’t you think, man?

You can now follow The Disco Blog on Twitter, baby!


be the first to rate this blog


About Andrew Glover

Andrew is the founder of the easyb BDD framework and the co-author of Addison Wesley's "Continuous Integration", Manning's "Groovy in Action" and "Java Testing Patterns". He is an author for multiple online publications including IBM's developerWorks and Oreilly's ONJava and ONLamp portals. He actively blogs about software at thediscoblog.com.