From c57653dd5bff8e7ad3d2863e63476cc1c3a43ab3 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Tue, 9 Aug 2022 14:38:19 +0200 Subject: [PATCH] Introduce `run-mutation-tests.sh` (#170) This script executes Pitest to determine the code base' mutation test coverage. The set of tests executed can optionally be restricted by name. The results are found in each Maven module's `target/pit-reports` directory. --- pom.xml | 8 ++++++-- run-mutation-tests.sh | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 run-mutation-tests.sh diff --git a/pom.xml b/pom.xml index 7ed1c987..cdc945db 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,8 @@ this 'argLine' property instead of the definition of the 'argLine' configuration setting allows users or plugins to specify additional arguments. In particular, JaCoCo relies on this for the configuration - of its Java agent. --> + of its Java agent, and Pitest uses this configuration when it spawns + additional JVMs. --> - -Xmx1024m + -Xmx${argLine.xmx} -Djava.awt.headless=true + + 1024m diff --git a/run-mutation-tests.sh b/run-mutation-tests.sh new file mode 100755 index 00000000..66826c14 --- /dev/null +++ b/run-mutation-tests.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Executes Pitest to determine the code base' mutation test coverage. The set +# of tests executed can optionally be restricted by name. The results are found +# in each Maven module's `target/pit-reports` directory. + +set -e -u -o pipefail + +if [ "${#}" -gt 1 ]; then + echo "Usage: ./$(basename "${0}") [TargetTests]" + exit 1 +fi + +targetTests=${1:-*} + +mvn clean test pitest:mutationCoverage \ + -DargLine.xmx=2048m \ + -Dverification.skip \ + -DfailIfNoTests=false \ + -Dtest="${targetTests}" \ + -DtargetTests="${targetTests}"