-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applying 'java-test-fixtures' plugin caused 'No mutations found' from Pitest. The plugin changes test runtime classpath: tested code is included as a JAR instead of as a directory (see gradle/gradle#11696). It seems that Pitest ignores correct directories being passed using --mutableCodePaths and insists on having those directories also passed in --classPath. Also change functional tests: runTasksSuccessfully() fails the test without giving any context, so it should be avoided.
- Loading branch information
Showing
8 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...funcTest/groovy/info/solidsoft/gradle/pitest/functional/TestFixturesFunctionalSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package info.solidsoft.gradle.pitest.functional | ||
|
||
import groovy.transform.CompileDynamic | ||
import nebula.test.functional.ExecutionResult | ||
|
||
@CompileDynamic | ||
class TestFixturesFunctionalSpec extends AbstractPitestFunctionalSpec { | ||
|
||
void "should work with kotlin and test fixtures"() { | ||
given: | ||
copyResources("testProjects/testFixtures", "") | ||
when: | ||
ExecutionResult result = runTasks('pitest') | ||
then: | ||
!result.standardError.contains("Build failed with an exception") | ||
!result.failure | ||
result.wasExecuted('pitest') | ||
result.standardOutput.contains('Generated 1 mutations Killed 1 (100%)') | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/funcTest/resources/testProjects/testFixtures/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apply plugin: 'java-library' | ||
apply plugin: 'java-test-fixtures' | ||
apply plugin: 'info.solidsoft.pitest' | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
dependencies { | ||
//Local/current version of the plugin should be put on a classpath earlier to override that plugin version | ||
// classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.1.7-SNAPSHOT' | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
group = "pitest.test" | ||
|
||
dependencies { | ||
testImplementation 'junit:junit:4.12' | ||
} |
1 change: 1 addition & 0 deletions
1
src/funcTest/resources/testProjects/testFixtures/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'testFixtures' |
7 changes: 7 additions & 0 deletions
7
src/funcTest/resources/testProjects/testFixtures/src/main/java/pitest/test/Library.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package pitest.test; | ||
|
||
public class Library { | ||
public boolean someLibraryMethod() { | ||
return true; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/funcTest/resources/testProjects/testFixtures/src/test/java/pitest/test/LibraryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package pitest.test; | ||
|
||
import org.junit.Test; | ||
import pitest.test.Library; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class LibraryTest { | ||
@Test public void testSomeLibraryMethod() { | ||
Library classUnderTest = new Library(); | ||
assertTrue("someLibraryMethod should return 'true'", classUnderTest.someLibraryMethod()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters