spec icon indicating copy to clipboard operation
spec copied to clipboard

Test failures don't show class name

Open mehaase opened this issue 8 years ago • 1 comments

I wrote a package that can interface with several different database systems (e.g. MySQL and Postgres). I wrote my integration tests as an abstract base class, and then wrote a concrete implementation for each database system. This way, each database runs the same battery of integration tests.

The downside of this approach is that all the test methods are shared between the test classes, so they all print out the same docstring when they run. If a test fails, it's not obvious which test class the failure occurred in.

Spec seems like a nice solution to this, since it clearly identifies which test class is running.

test runner output

Unfortunately, when an error occurs, only the method docstring is displayed, not the class, making the error ambiguous as to which test failed.

test exception

The exception message would be improved if it included the name of the test class.

mehaase avatar Oct 20 '16 18:10 mehaase

Yup this has bedeviled me for ages. Surprised I never made my own ticket for it. Thanks for the report! Happy to consider a patch if you come up with one.

bitprophet avatar Oct 22 '16 00:10 bitprophet