banking-kata-java
banking-kata-java copied to clipboard
Fix Mutation Testing - Adding Environment Variables to Gradle Pitest Plugin
Mutation testing used to work, but stopped working after the addition of environment variables
The error is:
` 4:46:45 PM PIT >> SEVERE : Tests failing without mutation: Description [testClass=com.optivem.kata.banking.BankingApplicationTests, name=[engine:junit-jupiter]/[class:com.optivem.kata.banking.BankingApplicationTests]/[method:contextLoads()]] Exception in thread "main" org.pitest.help.PitHelpError: 1 tests did not pass without mutation when calculating line coverage. Mutation testing requires a green suite. See http://pitest.org for more details. at org.pitest.coverage.execute.DefaultCoverageGenerator.verifyBuildSuitableForMutationTesting(DefaultCoverageGenerator.java:115) at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:97) at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:52) at org.pitest.mutationtest.tooling.MutationCoverage.runAnalysis(MutationCoverage.java:149) at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:139) at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:123) at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:54) at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:98) at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
`
I was searching for "Gradle Pitest Plugin Environment Variables"
I tried to set the environment variables, based on this https://stackoverflow.com/questions/56159077/set-environment-variables-in-gradle-pitest-plugin
tasks.named('pitest') { environment('env:POSTGRES_URL', 'jdbc:postgresql://localhost:5432/banking_kata') environment('$POSTGRES_USER', 'postgres') environment('POSTGRES_PASSWORD', 'admin') }
But still doesn't work.
Plan to continue further search.