Re: JUnit-BDD
Colin Vipurs <[email protected]> Tue, 22 Apr 2014 18:19:36 +0100
| Newsgroups | gmane.comp.java.junit.user |
|---|---|
| Message-ID | <CAKi4272xHxaC_=23FNu49cyXpOsm4ot0uZrqX+oeOW6eEa=7cQ@mail.gmail.com> |
It avoids the duplication between test description and method name as they become one. Frameworks that support it (pretty much everything in the Scala and JavaScript world) allow much more flexibility for test descriptions, something I'd consider a big win On Sat, Apr 19, 2014 at 6:56 PM, Cédric Beust ♔ <[email protected]> wrote: > > > On Fri, Apr 18, 2014 at 10:41 AM, David Saff <[email protected]> wrote: > > >> >> I think that Java 8 lambdas open up a lot of opportunities to accomplish >> JUnit's goals in completely different ways. I've been exploring with one >> approach myself on and off. For one thing, to date, JUnit has relied on >> specially-named or annotated methods to accomplish the goal of succinctly >> associating a name with a block of code. In Java 8, one can just do: >> >> addTest("Some test name", () -> { >> // some code here >> }) >> > I don’t see a lot of added value for this over > > @Test(description = "Some test name")public void shouldDoSomething) { ... } > > Actually, you lose a lot of expressivity that annotations give you for > free, such as adding configuration parameters to your test (e.g. specifying > concurrency settings, inheriting annotations from a base class, etc…). > > I’ve tried to find ways to leverage lambdas as well for testing and I’ve > come up completely empty so far. > -- > Cedric > > > -- Maybe she awoke to see the roommate's boyfriend swinging from the chandelier wearing a boar's head. Something which you, I, and everyone else would call "Tuesday", of course.