Skip to content

Commit

Permalink
[#198] Verify that source code is placed in HTML report
Browse files Browse the repository at this point in the history
  • Loading branch information
szpak committed Apr 21, 2020
1 parent 19e0947 commit 156c444
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class PitestPluginGeneralFunctionalSpec extends AbstractPitestFunctionalSpec {
buildFile << getBasicGradlePitestConfig()
buildFile << """
pitest {
timestampedReports = false //to do not mess with file path on source code in report verification
useClasspathFile = true
mainProcessJvmArgs = ["-XX:+UnlockExperimentalVMOptions"]
}
Expand All @@ -97,6 +98,9 @@ class PitestPluginGeneralFunctionalSpec extends AbstractPitestFunctionalSpec {
ExecutionResult result = runTasksSuccessfully('pitest')
then:
result.wasExecuted(':pitest')
and:
result.standardOutput.contains('Generated 2 mutations Killed 1 (50%)')
result.standardOutput.contains('Ran 2 tests (1 tests per mutation)')

and: "use file to pass additional classpath to PIT if enabled" //Needed? Already tested with ProjectBuilder in PitestTaskConfigurationSpec
result.getStandardOutput().contains(
Expand All @@ -105,6 +109,10 @@ class PitestPluginGeneralFunctionalSpec extends AbstractPitestFunctionalSpec {

and: "use defined mainProcessJvmArgs to run PIT main process"
result.getStandardOutput().matches(/(?m)[\s\S]*java(.exe)* -XX:\+UnlockExperimentalVMOptions[\s\S]*/)

and: "has source code available in report"
File htmlFileWithReportForHelloPit = new File(projectDir, "build//reports//pitest//gradle.pitest.test.hello//HelloPit.java.html")
htmlFileWithReportForHelloPit.text.contains("System.out.println(&#34;Mutation to survive&#34;);")
}

private String quoteBackslashesInWindowsPath(File file) {
Expand Down

0 comments on commit 156c444

Please sign in to comment.