Re: junit-nested: TestRunner for non-static inner classes
Esko Luontola <[email protected]> Wed, 14 Aug 2013 16:23:37 +0300
| Newsgroups | gmane.comp.java.junit.user |
|---|---|
| Message-ID | <CA+9baGFG6vxd8_mqVDQD_m-GAwQrcCrzUFxGEY0Uv+it+fOcnA@mail.gmail.com> |
As they say, great minds think alike. :) Some years ago I wrote a similar thing, even named it almost the same: https://github.com/orfjackal/nestedjunit If yours supports arbitrary depth, then that's more than nestedjunit does (it supports only max 2 levels of tests). Is the test isolation also the same? I got used to that style of organizing tests when learning TDD and writing tests with JDave. I've found 1-2 levels is nearly always enough, though I appreaciate the flexibility of arbitrary depth. For other JVM languages, and Java with lambda expressions, I've written an even more flexible testing framework: http://specsy.org/ You might like it, so have a look. (It requires the http://jumi.fi/ test runner, which is still lacking in tool support, so that's a negative side, for now.) On Wed, Aug 14, 2013 at 7:53 AM, Aaron V. <[email protected]> wrote: > ** > > > I'm announcing the 1.0 release of junit-nested, a TestRunner that allows > test classes to contain non-static inner classes which also have test > methods. Inner test classes can be nested to arbitrary depth, and @Before > and @After methods and @Rules will be run at all levels--that is, tests in > inner classes will get the benefit of befores and afters in their parent > (and grandparent, etc) classes. > > Of course, whether or not you _should_ make use of nested tests I find is > a matter of debate, but nonetheless it's a useful tool to have at your > disposal (and rspec (ruby), Cedar (obj-c) and jasmine (javascript) all > promote nested test structures). > > Source code (and an example) is available > https://github.com/avh4/junit-nested and the jar is available on maven > central as net.avh4.test:junit-nested:1.0.1 > > It is currently licensed under the EPL. If you have need of a different > license, please contact me. > > Also, if anyone with more knowledge of the internals of > BlockJUnit4ClassRunner can make any suggestions on improving my attempts to > extend it, I would appreciate the feedback. > > https://github.com/avh4/junit-nested/blob/master/src/main/java/net/avh4/test/junit/InnerRunner.java > > Cheers, > --Aaron V. > > [Non-text portions of this message have been removed]