moved a lot of repeated code into closures, and since the exit code for failing tests isn't non-zero, added logic to parse the XML reports and get error counts to accurately determine that the functional tests failed