pitest / pitclipse

Mutation testing for Java in Eclipse IDE. Based on PIT (Pitest).
https://pitest.org
Apache License 2.0
59 stars 17 forks source link

Update Pitest to 1.5.2 #117

Closed ebramirez closed 4 years ago

ebramirez commented 4 years ago

Motivation

The current version bundled version, 1.4.11, does not work in my setup while running the gradle plugin using 1.5.2 works. I upgraded the gradle version after encountering this error in stackoverflow:

Proposed Solution

Update the pitest bundled version to 1.5.2

echebbi commented 4 years ago

I see no problem in upgrading embedded Pitest's version however I don't understand how it would help you. Isn't the issue related to Pitest's Gradle plug-in rather than to Pitest itself?

I actually suspect that Pitclipse does not behave as expected with your project because it is likely not aware of Gradle dependencies. Could you detail what you mean by "does not work" and the error/logs you have when running PIT through Pitclipse?

ebramirez commented 4 years ago

Hi,

It could be the version of the Gradle plug-in, but I have no way of trying because the version 1.4.X of the plugin/pitest does not work either in Gradle.

By not working I mean that I can run the tests using the PIT Mutation Test Launch configuration, but I get this result: Captura de pantalla de 2020-06-19 11-42-39

Here is the console output in Eclipse: https://gist.github.com/ebramirez/a378952fad933659ae8d9a9b46945982

echebbi commented 4 years ago

Thank you very much for providing the full log. Tests are wrote with JUnit 5, aren't they? This is not reflected in the configuration you gave in StackOverflow but the logs show dependencies to JUnit Jupiter.

That matters because Pitclipse has to explicitely tell Pitest whether tests are written in JUnit 4 (default) or JUnit 5. The issue is that, currently, Pitclipse doesn't check dependencies fetched by third-parties and likely doesn't detect JUnit 5 in your project's classpath. The same issue has already been reported for Maven: #116.

ebramirez commented 4 years ago

Thanks for the quick response.

The StackOverflow question is not mine, I just found it while searching for the some guidance.

Yes, the tests a written in JUnit5 and is configured as such in Gradle:

plugins {
   id 'info.solidsoft.pitest' version '1.5.1'
}

pitest {
    junit5PluginVersion = '0.12'
    testSourceSets = [sourceSets.test]
}

How do I configure that in Pitclipse?

echebbi commented 4 years ago

How do I configure that in Pitclipse?

Currently you can't: I'll work on this as soon as possible. Meanwhile, a possible workaround might be to add the JUnit 5 library to the project:

  1. Right-click on the project > Build Path > Add libraries...
  2. JUnit > Next
  3. Select JUnit 5 > Finish

But it will likely caused conflicts with the JUnit 5 JARs pulled by Gradle.

Sorry for the inconvience, I'll keep you updated as soon as a fix is available.

echebbi commented 4 years ago

I've just deployed a new 2.2.1 version which should detect JUnit 5 even when provided by Gradle (but doesn't embed Pitest 1.5.2 yet). Could you test it and confirm that it does fix the issue?

If it doesn't, would you mind sharing a sample project where the analysis fails?

ebramirez commented 4 years ago

I can confirm that this works now in Eclipse 4.16.

Thank you very much @echebbi!