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

christophsturm

11/13/2019, 11:31 AM
does the latest minutest version change how tests are named? I have this in my pitest config
targetTests.set(setOf("randolf.*"))
and if I bump the minutest config it does not find tests anymore
with 1.9.0 it works
d

dmcg

11/13/2019, 5:04 PM
What is pitest config @christophsturm?
c

christophsturm

11/13/2019, 5:09 PM
oh. pitest is a mutation testing framework
and i thought maybe minutest 1.10 changed how test names are reported, so the test name filtering in pitests no longer works as expected
d

dmcg

11/13/2019, 5:18 PM
Ah yes. It wouldn’t shock me if I had broken that, although I don’t remember having to change any of the tests that do check naming since 1.9
c

christophsturm

11/13/2019, 5:23 PM
pitest is a great tool btw.
d

dmcg

11/13/2019, 7:25 PM
I’ve heard good things, but didn’t know it could be applied to Kotlin.
Please let me know if I can help with the test naming.
c

christophsturm

11/14/2019, 8:15 AM
if you want to see the problem in action you can check out randolf master, change the minutest version to 1.10 and run
./gradlew pitest
d

dmcg

11/14/2019, 8:53 AM
Ah, that kind of makes sense. Previously I was relying on the default behaviour for the test identifier - the result of which was (I think) that there was a MethodIdentifier pointing at
minutests()
in JUnit5Minutests - the
@TestFactory
.
Now I’m explicitly setting a file url to point to the source where the
test
and
context
methods are invoked. This lets IntelliJ jump to the actual source - but I bet will result in the TestIdentifier not having a MethodSource.
c

christophsturm

11/14/2019, 9:07 AM
can you just set the methodsource too?
or maybe trigger the old behavior with a property? pitest only runs from gradle
i really like my test setup, but it has a lot of moving parts, minutest, pitest, pitest-gradle, pitest-junit5-plugin
d

dmcg

11/14/2019, 9:44 AM
I could, but it would be better to make pitest better? What does it do with the information?
c

christophsturm

11/14/2019, 10:03 AM
hmm i can file an issue in the pitest-junit5 repo
i think it uses the method source for the test name filtering
isnt it the right thing to do to set the MethodSource?
d

dmcg

11/14/2019, 10:43 AM
There isn’t a method, just the invocation of ‘test’
c

christophsturm

11/14/2019, 1:11 PM
i think this is the check that fails:
Copy code
.filter(testIdentifier -> testIdentifier.getSource().isPresent())
and i think i can fix it in the pitest junit plugin
submitted an issue in the junit plugin https://github.com/pitest/pitest-junit5-plugin/issues/39
once thats fixed i can add pitest to the minutest build if you want
I looked into it and junit5 is a really confusing api. maybe the easiest way is to set the method source again?
d

dmcg

11/15/2019, 10:05 AM
You’re not wrong about the API
I don’t think that I can have a MethodSource URI and a file one.
c

christophsturm

11/15/2019, 10:09 AM
ahhh
ok
i think i have a fix for the junit plugin
d

dmcg

11/15/2019, 10:10 AM
👍
c

christophsturm

11/15/2019, 10:10 AM
but i have no idea how to use my locally built jar file with gradle
do i need to add a mavenLocal() source?
d

dmcg

11/15/2019, 10:11 AM
I think you can just do ./gradlew install
and it will install it into ~/.m2
c

christophsturm

11/15/2019, 10:12 AM
its a maven project but I’ll try
ok it works locally for me and i submitted a PR
hmm it seems it doesnt really fix it. maybe we need a separate pitest plugin for minutest.
minutest-junit5 is not really a lot of code
the test identifiers seem to be exactly the same with 1.10 and 1.9 so it must be something different.
d

dmcg

11/20/2019, 7:48 AM
TBH I’m a bit surprised that PiTest worked at all with Minutest - I would have expected it to be quite sensitive to the form of test specification.
Another thought - I upgraded the version of JUnit that Minutest uses between 1.9 and 1.10. (5.4.0 -> 5.5.2). That might mean that you are getting a later version with some other incompatibilty?
c

christophsturm

11/20/2019, 7:54 AM
in the randolf project i have every dependency bumped to latest (also junit) and it works
d

dmcg

11/20/2019, 8:50 AM
So that’s Minutest 1.9 running against JUnit 5.5.2? Hmm, back to the drawing board
c

christophsturm

11/20/2019, 9:16 AM
I’m suprised that it shows method source for minutest when you said you changed it.
do you think its easy to serialize the output of the junit api to json and back? then i could just use that for a pitest-junit unittest
d

dmcg

11/22/2019, 1:04 PM
I’m afraid I really don’t know what pitest is doing with the information, and I’m a bit snowed under. Are you going to be at KotlinConf - we could look at it together there?
c

christophsturm

11/25/2019, 9:46 AM
sadly not. I think I’m just going to create a pitest minutest plugin then i can use tdd to do it instead of manually trying out things, which i don’t really like
kotlintest has a pitest plugin and its also apache license so i could use that as a starting point
probably less fun than starting from scratch, but a pragmatic solution
9 Views