From: David S. <da...@sa...> - 2011-07-15 17:52:36
|
Behrang, Sorry for the long response delay. This is an interesting idea. You should be able to try it out fairly easily: 1) Create your own subclass of BlockJUnit4ClassRunner that overrides describeChild 2) Annotate your classes with @RunWith(MyRunner.class) One thing to watch out for is whether your running infrastructure (ant, maven, eclipse, etc.) is robust against spaces in test descriptions. If it works out for you, let's think about contributing it to junit.contrib. Thanks, David Saff On Sat, Jul 9, 2011 at 7:38 PM, Behrang Saeedzadeh <beh...@gm...> wrote: > Hi, > > I think it would be nice if there was an annotation for JUnit for > naming annotations. > > Right now creating test cases with self explanatory names lead very > long and ugly methods names, e.g.: > > @Test > public void headingElementShouldNotBeResolvedWithoutNamespaceMapping() { > } > > @Test > public void headingElementShouldBeResolvedWithNamespaceMapping() { > } > > It would be nice if we could have named the test case in an annotation, e.g.: > > @Test > @Name("Heading Element Should Not Be Resolved Without Namespace Mapping") > public void testResolution1() { > } > > @Test > @Name("Heading Element Should Be Resolved With Namespace Mapping") > public void testResolution2() { > } > > or maybe even: > > @Test(name = "Heading Element Should Not Be Resolve Without Namespace Mapping") > public void testResolution1() { > } > > @Test(name = "Heading Element Should Be Resolved With Namespace Mapping") > public void testResolution2() { > } > > Right now I have started using a similar annotation for my new > projects, but had it been integrated with JUnit, it would have used > the name in reporting errors, etc. > > A @Description element might also be useful for providing more details > about a test. > > Cheers, > Behrang Saeedzadeh > http://www.behrang.org > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Junit-devel mailing list > Jun...@li... > https://lists.sourceforge.net/lists/listinfo/junit-devel > |