Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pitest generates unhelpful mutations when using Kotlin's coroutines #579

Closed
matejdro opened this issue Mar 1, 2019 · 6 comments
Closed

Comments

@matejdro
Copy link

matejdro commented Mar 1, 2019

This Kotlin code sample that uses coroutines:

private fun test() {
    GlobalScope.launch {
    }
}

Will create bunch of replaced equality check with false mutations, even though there are no equality checks in actual kotlin code.

This was reproduced with Android fork of the pitest gradle plugin v0.1.9, which uses 1.4.0 pitest version and ALL operators enabled.

@Michael-Nolan
Copy link
Contributor

My understanding is that while PITest technically can run against any JVM language, you will get nonsense results in any language except Java. This is because Java has a straight forward conversion from source code to byte code. All other languages do extra processing so there is no longer a 1:1 relationship of source to byte code.

It would be awesome though if pitest could be enhanced to support the other jvm languages.

@fveerden
Copy link

I ran pitest 1.4.10 against kotlin code with some async calls and it produces a lot of errors. Mainly errors in the coroutines machinery regarding continuation and completion. Somehow pitest and coroutines do not mix well.
Of course coroutines is something Java does not have (yet), so it might be understandable that it is not working well with pitest. Also because of what @Michael-Nolan said, but still, since a lot of Java developers are moving to Kotlin, better coroutine support would be welcome.
Addition of coroutines and async calls add a completely new syntax and processing concept, so I can imagine that this could be a challenge to mutation test properly.

@Michael-Nolan
Copy link
Contributor

Have you tried the Pitest Kotlin plugin? https://github.com/pitest/pitest-kotlin

I haven't had a chance to try it, but it might work for you.

@hcoles
Copy link
Owner

hcoles commented Jan 18, 2020

The plugin does not have support for co-routines yet. Unfortunately no one has stepped forward to maintain it so it is not progressing.

I've been toying with the idea of some sort support subscription that could fund development, but I'm not sure there would be sufficient interest.

@Michael-Nolan
Copy link
Contributor

I've been toying with the idea of some sort support subscription that could fund development

I'd be interested to see that. Open source projects really do need a source of funding. The work you do has value.

@hcoles
Copy link
Owner

hcoles commented Mar 2, 2022

The Arcmutate kotlin plugin now provides support for coroutines

@hcoles hcoles closed this as completed Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants