pitest-ant-example & junit-4.11+ [Line Coverage @ 0%]

51 views
Skip to first unread message

Badger

unread,
Jul 26, 2022, 11:15:20 AM7/26/22
to PIT Users
Greetings,

I am not very familiar with posting like this, my apologies ahead of time for anything wrong - heh.
Further apologies if this has already been brought up; I feel I have looked extensively, however was not able to find any existing references - Please point me in the right direction if this has already been addressed.


While trying to incorporate PITest to an existing code-base using ant and junit-4.13.2, I found this issue(?) that is easily reproduced with the pitest-ant-example.
I have not found a solution yet, and would greatly appreciate any input to move forward.
["Hopefully" it is just something silly I have simply missed, and an easy fix]

Expected: PITest report with coverage above 0%.
Actual: PITest report with 0% coverage

Steps to reproduce:
- Move: junit-4.13.2.jar to lib/junit.4.13.2.jar
- Edit: build.xml @ L41 : junit-4.9.jar -> junit.4.13.2.jar
- Run: ant pit
- Load index.html and observe Line Coverage at 0%

Observations/Notes:
* Running the example out of the box without modification, reports Line Coverage at 84%
* Using junit.4.10 in the example project, also reports Line Coverage at 84%
* Using junit 4.11, 4.12, 4.13.2 in the example project, all report 0% as noted above
* Modifying build.xml @ L9-11 to use PITest 1.9.3 jars downloaded from Maven Central produces the same results as noted above for various junit versions. [eg: Does not appear to resolve the issue]
-
* Using the junit-4.9.jar from the example with our existing code-base, junit/jacoco report is Green however PITest fails with the requires-Green error.
* Using junit-4.10.jar from Maven Central with our existing code-base, junit/jacoco report is Green however PITest fails with the requires-Green error. [Same as above]
* Using junit-4.11, 4.12, or 4.13.2 with our existing code-base, junit/jacoco report Green and PITest completes successfully, however as noted above is reporting 0% Line Coverage.
* Notably, with 4.11 - 4.13.2, PITest report often includes the FooTest files in the report as if they were source-files not test-files.
-
* While not sure if relevant, ant is 1.10.11 just for reference.


Please let me know if there is any additional information I can provide.

If anyone has any advice on how to proceed, I would be very appreciative for any input.

Thank you,
~Badger

Henry Coles

unread,
Jul 26, 2022, 11:50:32 AM7/26/22
to pitu...@googlegroups.com
Recent versions of junit require hamcrest to separately added to the classpath. I have updated the ant-example to use 4.13.2 and the latest version of pitest.

Henry

--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitusers/965e4819-adf4-4b38-a11d-498553f3ce40n%40googlegroups.com.

Badger

unread,
Jul 26, 2022, 12:48:35 PM7/26/22
to PIT Users
Thank you for such a swift reply, very much appreciated. [And thank you for all your hard work on this project, too!]

I see the example and have ran it successfully, my apologies for not being aware of the hamcrest junit requirement - but that certainly explains a lot.

Unfortunately, it's still not reporting correctly in our code-base; however, I strongly suspect that is our end, and I will spend some time with this updated new information to see if I can find the solution.

Additionally however, I have also noticed a peculiarity I wonder if you/someone could advise on.
The existing code-base (before my time) was configured to output the class binaries to a folder format like "proj-FOO.jar" - where the folder name looks like a .jar file.
This seems to confuse PITest, and is also reproducible in the example script by just changing '/classes' to '/classes.jar' where applicable. [Lines 27, 30, and 38 - if I hadn't shifted any lines in the example file]
I suspect PITest is just trying to treat the paths as .jar files instead of folders - is there any way to specify folder in this case?
I can't readily change the class output path in our build.xml at this time; however, I was at least able to work-around it by copying the classes path's elsewhere and running PITest on the copy.

Lastly, if by end-of-day I've not managed to figure out why our code-base isn't reporting correctly, is it appropriate/acceptable to ask for assistance here? Entirely understandable if this space is meant for PITest specific issues; since I suspect it's something I'm missing on our end, at this point.

Thank you again for your time and efforts,
~Badger
Reply all
Reply to author
Forward
0 new messages