-
Notifications
You must be signed in to change notification settings - Fork 9
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
Issue running Pitest in Android projects with Kotlin #71
Comments
Android projects using kotlin should work. There are few functional tests: https://github.com/koral--/gradle-pitest-plugin/tree/master/src/funcTest/resources/testProjects/simpleKotlin |
Hi @koral--, absolutely. In my experience, when working with simple Kotlin classes the plugin works well. The problem appears when we start to work with more advanced Kotlin functionalities such as @parcelize annotations. I have just created a repository that reproduces the issue: https://github.com/phellipealexandre/MutationTestAndroid You just need to clone it and execute the command in terminal: |
also see the original issue in the pitest repo: hcoles/pitest#764 its possible that this is a kotlin bug. pitest requires source code info for all methods that are not synthetic, and it seems in some cases kotlin omits source code info for autogenerated classes that are not synthetic. |
Just an FYI for anyone else looking at this, you can use this to exclude these from mutation testing. Not ideal, but it gets pitest working on the rest of the source.
|
I've updated all of the dependecies on @phellipealexandre example repo (https://github.com/vojtechpesek/MutationTestAndroid/tree/updated-dependencies) and tried to run pitest with
Obviously, it has issues with mockk. Solutions like changing to other JDK but that didn't work either. Running the test from Android Studio and command line passes, so this will be something specific to pitest and how it runs the tests. Any ideas? |
Btw, @hcoles, the PIT author has created a new engine which supports Kotlin in a better way than a default one. It is available as a part of the commercial tool/solution Arcmutate. Some projects/companies could be interested in it (however, I haven't been using it). |
Thanks @szpak By coincidence I'm looking at the issue with Mockk (and I think more generally with kotlin annotations) at the moment. |
I've seen the commercial solution, will ask for trial. It is in beta and not everything works out of the box but I need to take a closer look. Also, @hcoles let me know if you find out something with mockk issue. :-) |
Hello!
Firstly, I would like to thank you for this awesome project and for all the contributions you have made so far.
I have been playing recently with this plugin in a large Android project with Kotlin and I am having many issues to run the mutation tests in classes that uses the @Parcelize annotation or uses the when keyword from Kotlin.
I am using version '0.2.5' and I saw a similar issue in Pitest's repository. Basically the error is:
I am pasting the complete stacktrace of the error below:
I think the main question I would like to ask with this issue is: Does the Pitest Android plugin supports Android projects with Kotlin?
Thanks in advance and have a nice day!
The text was updated successfully, but these errors were encountered: