Add fail() function in tests: fail a test by throwing an error