Class JzapExtension
Everything here describes what to analyse and how to report. Nothing here describes how analysis works: that belongs to the engine, and keeping the line clear is what stops this plugin from slowly accumulating a second copy of the tool.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.file.DirectoryPropertyDirectory holding the incremental cache.abstract org.gradle.api.file.ConfigurableFileCollectionExplicit engine classpath, overridinggetEngineVersion().abstract org.gradle.api.provider.Property<String>Engine version to run.abstract org.gradle.api.provider.ListProperty<String>Class-name globs never to mutate.abstract org.gradle.api.provider.Property<Boolean>Fail the build if any mutant survives.abstract org.gradle.api.provider.Property<String>getFrom()Base git ref for diff scoping.abstract org.gradle.api.provider.ListProperty<String>Class-name globs to mutate.abstract org.gradle.api.provider.ListProperty<String>Extra JVM arguments for the analysis JVMs that run the tests.abstract org.gradle.api.provider.Property<Boolean>Also mutate loop counters, which are suppressed by default.abstract org.gradle.api.provider.ListProperty<String>Mutator ids.abstract org.gradle.api.provider.ListProperty<String>Reporter ids: console, json, elements, html, annotations.abstract org.gradle.api.provider.Property<String>getScope()lineto mutate only changed lines,classto widen to changed classes.abstract org.gradle.api.provider.Property<Integer>Analysis JVMs.Fail the build if the mutation score falls below this percentage.abstract org.gradle.api.provider.Property<String>getTo()Tip git ref for diff scoping.voidsetThreshold(Number value) A plain scalar rather than aProperty<Double>, and typed asNumber.
-
Constructor Details
-
JzapExtension
public JzapExtension()
-
-
Method Details
-
getEngineVersion
Engine version to run. Defaults to the plugin's own version. -
getEngineClasspath
public abstract org.gradle.api.file.ConfigurableFileCollection getEngineClasspath()Explicit engine classpath, overridinggetEngineVersion().Set this to run a locally built engine, which is also how this plugin's own tests work:
jzap { engineClasspath.setFrom(fileTree("path/to/jzap/lib") { include("*.jar") }) }This is the answer when the engine cannot be resolved from a repository. The failure in that case comes from Gradle's dependency resolution rather than from jzap; see
JzapTask.getEngineClasspath()for why it is left that way. -
getThreads
Analysis JVMs. Defaults to one.Raise it when the test suite is slow or spends its time waiting, where an extra analysis JVM gains almost linearly. On a suite of fast CPU-bound tests it can cost more than it saves, which is why the default does not guess; see
ProjectModel.DEFAULT_THREADS. -
getReporters
Reporter ids: console, json, elements, html, annotations. -
getFrom
Base git ref for diff scoping.Honoured by
mutationTestDiff, which falls back toHEAD, and bymutationTestAll, which has no fallback and analyses every module when no range is given.mutationTestis a full run by definition and ignores it.Setting it here wins over the
JZAP_FROMenvironment variable, which exists for CI that knows the base branch and cannot edit the build script. -
getTo
Tip git ref for diff scoping.-Local-means uncommitted changes and-Empty-the empty tree.Same precedence and the same tasks as
getFrom(); the environment variable isJZAP_TO. -
getScope
lineto mutate only changed lines,classto widen to changed classes. -
getIncludeClasses
Class-name globs to mutate. Empty means everything in the module's output. -
getExcludeClasses
Class-name globs never to mutate. -
getMutators
Mutator ids. Empty means the default set. -
getMutateLoopCounters
Also mutate loop counters, which are suppressed by default. -
getFailOnSurvivors
Fail the build if any mutant survives. -
getJvmArgs
Extra JVM arguments for the analysis JVMs that run the tests. -
getCacheDir
public abstract org.gradle.api.file.DirectoryProperty getCacheDir()Directory holding the incremental cache. Unset means no caching.Off by default, including here. A cache whose whole question is whether reuse is sound should not start reusing without being asked, and a build that silently reuses verdicts is hard to reason about the first time one looks wrong.
-
getThreshold
Fail the build if the mutation score falls below this percentage. -
setThreshold
A plain scalar rather than aProperty<Double>, and typed asNumber.In a Groovy build script
threshold = 80.0produces aBigDecimal, which Gradle will not assign to aProperty<Double>; and Gradle forbids declaring a setter next to an abstract property getter, so the two cannot be combined. Without this, the obvious way to write the obvious thing fails with a type error.
-