Ability to automatically retry failing tests

I've added the ability to have failed tests retry automatically by setting a max.retries property (which defaults to 0).