#890 @test facet for sys::Test

tactics Wed 30 Dec 2009

I might have missed the ship with all the breaking changes the other week, but I'd like to see the testXXX name convention used by sys::Test to be replaced with a @test facet. Again, this is one of those features that simply wasn't available when the original design was created.

This would be the perfect example of where a facet is useful. It's metadata telling you something about the method. In addition, it would make it pretty easy to enumerate tests on a subtype of Test (currently, you have to use a punch of Str.startsWith checks).

msl Wed 30 Dec 2009

I like it.

But I think it feels a little bit mis-matched to have tests annotated with @test while setup() and teardown() are left as methods. Perhaps they need to be faceted out as well - @before and @after?

This pretty much leaves sys::Test as being little more than the JUnit Assert class, which I don't think is a bad thing?

tactics Wed 30 Dec 2009

The difference between the testXXX methods and setup and teardown is that they are virtual methods, not a naming convention. Since there's only one of each, it can be done with subclassing. But since there can be zero or more test methods, they cannot.

brian Wed 30 Dec 2009

See previous discussion. Lots of opinions on both sides of the fence.

To sum up my position: I strongly favor convention over configuration in this case. If best practice is to prefix a test method with "test", then why not force the convention and avoid additional noise in the code.

it would make it pretty easy to enumerate tests on a subtype of Test (currently, you have to use a punch of Str.startsWith checks).

might be worth a helper method to encapsulate this (for now and if we ever decided to use facets in the future)

Login or Signup to reply.