Error using PIT from gradle: SEVERE : JUnit was not found on the classpath. PIT requires JUnit 4.6 or above.

466 views
Skip to first unread message

tdiff...@fitbit.com

unread,
Oct 2, 2018, 1:01:15 AM10/2/18
to PIT Users
I'm using the gradle plugin to run PIT in a gradle project with subprojects.

I've added junit 4.11 ("junit:junit:4.11"to both `testCompile` and `compile` within a subproject's `dependencies` in the subproject build.gradle.

To the top-level build.gradle, I've added:

pitest {
    targetClasses = ['one.class.in.the.Subproject']  
    outputFormats = ['XML', 'HTML']
    timestampedReports = true
}

But I've getting this when I run 
    ../gradlew pitest 
from the subproject directory:

7:49:47 PM PIT >> INFO : Sending 0 test classes to minion
7:49:47 PM PIT >> INFO : Sent tests to minion
7:49:47 PM PIT >> INFO : MINION : 7:49:47 PM PIT >> INFO : Checking environment

7:49:47 PM PIT >> INFO : MINION : 7:49:47 PM PIT >> SEVERE : JUnit was not found on the classpath. PIT requires JUnit 4.6 or above.
See http://pitest.org for more details.

7:49:47 PM PIT >> SEVERE : Error generating coverage. Please check that your classpath contains JUnit 4.6 or above.
Exception in thread "main" org.pitest.util.PitError: Coverage generation minion exited abnormally. Please check the classpath.

Any idea what I'm doing wrong?

Thanks,
Tom

tdiff...@fitbit.com

unread,
Oct 2, 2018, 1:03:50 AM10/2/18
to PIT Users
Oh, and.... Which classpath is pit looking at, testCompile or compile?

henry

unread,
Oct 4, 2018, 1:13:18 PM10/4/18
to PIT Users
Hi Tom,

Not sure if the maintainer of the gradle plugin monitors this group, you might be better asking at https://github.com/szpak/gradle-pitest-plugin

Marcin Zajączkowski

unread,
Oct 4, 2018, 3:36:05 PM10/4/18
to tdiffenbach via PIT Users
On 2018-10-02 07:01, tdiffenbach via PIT Users wrote:
> I'm using the gradle plugin to run PIT in a gradle project with subprojects.
>
> I've added junit 4.11 ("junit:junit:4.11") to both `testCompile` and
> `compile` within a subproject's `dependencies` in the subproject
> build.gradle.

testCompile is fine.

> To the top-level build.gradle, I've added:
>
> pitest {
> targetClasses = ['one.class.in.the.Subproject']
> outputFormats = ['XML', 'HTML']
> timestampedReports = true
> }

It's ok.

> But I've getting this when I run
> ../gradlew pitest
> from the subproject directory:

Should be fine. Can you:
- run "./gradlew pitest" from the root directory
- run the pitest task with "--info" and paste a part where the command
line options passed to PIT are displayed.

Marcin


>
> 7:49:47 PM PIT >> INFO : Sending 0 test classes to minion
> 7:49:47 PM PIT >> INFO : Sent tests to minion
> 7:49:47 PM PIT >> INFO : MINION : 7:49:47 PM PIT >> INFO : Checking
> environment
>
> 7:49:47 PM PIT >> INFO : MINION : 7:49:47 PM PIT >> SEVERE : JUnit was not
> found on the classpath. PIT requires JUnit 4.6 or above.
> See http://pitest.org for more details.
>
> 7:49:47 PM PIT >> SEVERE : Error generating coverage. Please check that
> your classpath contains JUnit 4.6 or above.
> Exception in thread "main" org.pitest.util.PitError: Coverage generation
> minion exited abnormally. Please check the classpath.
>
> Any idea what I'm doing wrong?
>
> Thanks,
> Tom
>


--
https://blog.solidsoft.info/ - Working code is not enough

Marcin Zajączkowski

unread,
Oct 4, 2018, 3:36:57 PM10/4/18
to 'henry' via PIT Users
On 2018-10-04 19:13, 'henry' via PIT Users wrote:
> Hi Tom,
>
> Not sure if the maintainer of the gradle plugin monitors this group, you
> might be better asking at https://github.com/szpak/gradle-pitest-plugin

The group is fine for questions. I subscribed to it and usually answer
to Gradle related questions (sooner or later :) ).

Marcin


>
> On Tuesday, 2 October 2018 06:03:50 UTC+1, <>.com wrote:
>>
>> Oh, and.... Which classpath is pit looking at, testCompile or compile?
>>
>


Reply all
Reply to author
Forward
0 new messages