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

Handle Classpath properly and consistently #142

Closed
LorenzoBettini opened this issue Jul 12, 2021 · 1 comment · Fixed by #143
Closed

Handle Classpath properly and consistently #142

LorenzoBettini opened this issue Jul 12, 2021 · 1 comment · Fixed by #143
Assignees
Labels
for: CI 🚀 Related to Continuous Integration priority: high ⚡ Must be done quickly
Milestone

Comments

@LorenzoBettini
Copy link
Collaborator

Currently, the classpath is generated by org.pitest.pitclipse.core.PitCoreActivator.start(BundleContext) (and also by org.pitest.pitclipse.runner.PitRunnerTest.classPathWithPitestAndJUnit()) by putting the required bundle location and the same required bundle location with the appended "/bin".

This assumes that the ".class" files are always generated into the output "bin" folder, but that's not the case during the Maven/Tycho build, which generates into "target/classes". During the Tycho build the classpath works thanks to the actual bundle location, which in that case is NOT a project folder, but the JAR.

Thus, it works basically but it raises a few false positives like in the org.pitest.pitclipse.runner.PitRunnerTest.shouldRunPitest(): when run from Eclipse the PIT runner actually generates mutants (since it finds the class to mutate in the test, PitOptions, in the "bin" folder"); when run from Tycho no mutants are generated, since it does not find the class (the classpath is the JAR and the JAR location + "/bin", which of course does not exist). The test however succeeds, because it only checks whether the HTML report dir can be found. In previous versions of PIT the HTML report dir is always generated but in the newer versions it is not, in fact, the test fails with an NPE in #123

The test can be fixed by running PIT in that test by using a test and a class in the same test projects, e.g., org.pitest.pitclipse.example.ExampleTest.

In any case, I'd suggest configuring all the .classpath files to generate into target/classes so that the output will be the same in Eclipse and during the build. This should avoid us some bad headaches in the future

@LorenzoBettini LorenzoBettini added priority: high ⚡ Must be done quickly for: CI 🚀 Related to Continuous Integration labels Jul 12, 2021
@LorenzoBettini LorenzoBettini added this to the 2.2.0 milestone Jul 12, 2021
@LorenzoBettini LorenzoBettini self-assigned this Jul 12, 2021
@LorenzoBettini
Copy link
Collaborator Author

For example, even when that test succeeds with older versions of PIT in the Maven build output you can spot:

WARNING : No mutations found. This probably means there is an issue with either the supplied classpath or filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: CI 🚀 Related to Continuous Integration priority: high ⚡ Must be done quickly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant