Count tests in the testOutcome method when creating junitxml

Previously, they were being counted in the startTest hook, but
this was sometimes generating inconsistent XML.