https://kotlinlang.org logo
#feed
Title
# feed
d

dmcg

03/29/2019, 12:01 PM
My New Test Model - treating test fixtures with the respect they deserve http://oneeyedmen.com/my-new-test-model.html
m

mkobit

03/29/2019, 1:41 PM
minutest
is pretty great - we've been using it to supplement our other testing in our projects we usually have something like
Copy code
inline fun <reified T> testFactory(noinline builder: TestContextBuilder<Unit, T>.() -> Unit): Stream<out DynamicNode> =
    testFactoryFor(
        rootContext(builder = builder)
    )
and don't inherit from
JUnit5Minutests
so we can express tests as "multiple" contexts
d

dmcg

03/29/2019, 1:49 PM
I'm glad you like it. Does the fact that JUnit5Minutests will now run any public methods returning the result of
rootContext
allow you to do the same thing?
m

mkobit

03/29/2019, 3:04 PM
yeah i think that would work just as well. i think we've been following this pattern so far as we've been replacing all of our
DynamicTest.dynamicTest
and
DynamicContainer.dynamicContainer
, since those methods usually are something like
Copy code
@TestFactory
fun `some test method`(): Stream<out DynamicNode> = Stream.of(...)
seems like
testFactory
is our own analogous representation when we started to use minutest (which is recently)
d

dmcg

03/31/2019, 9:46 AM
I'm discovering that I'm not the only one to have seen the potential of @TestFactory!
44 Views