Improve error reporting in test cases

Suggested improvement by Jochen Topf in #143