From ec0998caa4375229d116b0e6bc6d7ed677c78e32 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 27 May 2024 16:14:03 -0700 Subject: [PATCH 1/2] Added script to list parameters --- cliargs.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 cliargs.sh diff --git a/cliargs.sh b/cliargs.sh new file mode 100755 index 0000000..d5fccfd --- /dev/null +++ b/cliargs.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +java -cp "lib/test/*" org.pitest.mutationtest.commandline.MutationCoverageReport --help |\ +grep "^.*--.*" |\ +sed -e "s/\* --/--/" -e "s/ .*//" -e "s/^--/\"--/" -e "s/$/\",/" |\ +sort |\ +sed -e '/testPlugin/d' -e '/--help/d' -e '/---/d' -e '$s/,//' \ No newline at end of file From e7ed7edc3080080438895809810ece3bb85ba615 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 27 May 2024 16:15:40 -0700 Subject: [PATCH 2/2] Fixed missing maxMutationsPerClass parameter --- .../java/rife/bld/extension/PitestOperation.java | 11 +++++++++++ .../rife/bld/extension/PitestOperationTest.java | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/rife/bld/extension/PitestOperation.java b/src/main/java/rife/bld/extension/PitestOperation.java index f4b737f..8175f17 100644 --- a/src/main/java/rife/bld/extension/PitestOperation.java +++ b/src/main/java/rife/bld/extension/PitestOperation.java @@ -592,6 +592,17 @@ public class PitestOperation extends AbstractProcessOperation { return this; } + /** + * Maximum number of surviving mutants to allow without throwing an error. + * + * @param maxMutationsPerClass the max number + * @return this operation instance + */ + public PitestOperation maxMutationsPerClass(int maxMutationsPerClass) { + options.put("--maxMutationsPerClass", String.valueOf(maxMutationsPerClass)); + return this; + } + /** * Maximum number of surviving mutants to allow without throwing an error. * diff --git a/src/test/java/rife/bld/extension/PitestOperationTest.java b/src/test/java/rife/bld/extension/PitestOperationTest.java index caf5655..63a27f6 100644 --- a/src/test/java/rife/bld/extension/PitestOperationTest.java +++ b/src/test/java/rife/bld/extension/PitestOperationTest.java @@ -77,12 +77,13 @@ class PitestOperationTest { "--fullMutationMatrix", "--historyInputLocation", "--historyOutputLocation", - "--includeLaunchClasspath", "--includedGroups", "--includedTestMethods", + "--includeLaunchClasspath", "--inputEncoding", "--jvmArgs", "--jvmPath", + "--maxMutationsPerClass", "--maxSurviving", "--mutableCodePaths", "--mutationEngine", @@ -122,8 +123,8 @@ class PitestOperationTest { .excludedGroups(List.of(FOO, BAR)) .excludedMethods("method") .excludedMethods(List.of(FOO, BAR)) - .excludedTestClasses("test") .excludedRunners("runners") + .excludedTestClasses("test") .exportLineCoverage(true) .failWhenNoMutations(true) .features("feature") @@ -136,6 +137,7 @@ class PitestOperationTest { .inputEncoding("encoding") .jvmArgs("-XX:+UnlogregckDiagnosticVMOptions") .jvmPath("path") + .maxMutationsPerClass(3) .maxSurviving(1) .mutableCodePaths("codePaths") .mutationEngine("engine") @@ -456,6 +458,14 @@ class PitestOperationTest { assertThat(op.options.get("--jvmPath")).isEqualTo(FOO); } + @Test + void maxMutationsPerClass() { + var op = new PitestOperation() + .fromProject(new BaseProject()) + .maxMutationsPerClass(12); + assertThat(op.options.get("--maxMutationsPerClass")).isEqualTo("12"); + } + @Test void maxSurviving() { var op = new PitestOperation()