Improved error checking in test framework