Fix issues in the JUnitFormatter

Change the JUnitFormatter to handle failures in the before and after
hooks properly. Also change the JUnitFormatter to handle both
all-steps-first execution and one-step-at-the-time execution.