https://kotlinlang.org logo
#minutest
Title
# minutest
n

natpryce

11/26/2018, 9:52 PM
If
TestDescriptor
is actually a
TestExecution
, then it can register resources that need to be cleaned up at the end of the test run…
d

dmcg

11/26/2018, 10:44 PM
I'd like to see a use-case.
n

natpryce

11/26/2018, 10:46 PM
Spawning a redis service as a background process, for example
Or creating a resources in a message broker
d

dmcg

11/27/2018, 8:26 AM
I know what cleanup is! What I mean is, how would it look - compared to after, afterAll, how you square the difference between single test execution and all test executions
n

natpryce

11/27/2018, 8:39 AM
What we currently do with lazy global properties.
that only lets us clean up what the OS cleans up at the end of the process.
(And the JUnit TestEngine API does not constrain execution to once per process or even single threaded, so maybe we shouldn’t rely on that)
d

dmcg

11/27/2018, 2:56 PM
At the moment I use JUnit 5's @AfterAll to clean up when I have globalish resources (an SSH tunnel in particular)
I can see that it would be good to have a pure way to do that, but the devil is in the detail. A test execution is too early - you'd need a afterAll exections
n

natpryce

11/27/2018, 3:05 PM
AfterAll runs after all tests in a class, which couples resource lifetime to the way one groups/organises tests to clarify communication to the reader. Which is what I’d like to avoid.
d

dmcg

11/27/2018, 3:08 PM
So you want TestsExecution
which I can see would be nice
but couples usage to your runner
n

natpryce

11/27/2018, 3:10 PM
Well… if you use Jupiter, you can continue to use @AfterAll. But if you use the MinutestTestEngine, there’d be another mechanism.
👋 But it’s all a bit hand-wavy at the moment 👋
5 Views