From 156c44421e1d058badfac86c9efd6afdb4182c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Zaj=C4=85czkowski?= Date: Tue, 21 Apr 2020 16:04:11 +0200 Subject: [PATCH] [#198] Verify that source code is placed in HTML report --- .../functional/PitestPluginGeneralFunctionalSpec.groovy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/PitestPluginGeneralFunctionalSpec.groovy b/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/PitestPluginGeneralFunctionalSpec.groovy index 434f98fb..cf194fc0 100644 --- a/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/PitestPluginGeneralFunctionalSpec.groovy +++ b/src/funcTest/groovy/info/solidsoft/gradle/pitest/functional/PitestPluginGeneralFunctionalSpec.groovy @@ -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"] } @@ -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( @@ -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("Mutation to survive");") } private String quoteBackslashesInWindowsPath(File file) {