Package com.arc_e_tect.gradle.gherkin
Class GenerateFeatureDocsTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.arc_e_tect.gradle.gherkin.GenerateFeatureDocsTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
@DisableCachingByDefault(because="Generated documentation depends on source file content and is cheap to regenerate")
public abstract class GenerateFeatureDocsTask
extends org.gradle.api.DefaultTask
Gradle task that scans
.feature files and writes all scenario titles
to a single AsciiDoc file.
Caching is intentionally disabled: the output depends entirely on the contents of the feature files and regeneration is cheap.
Either getSourceDirs() or getSourceFile() must be
configured, but not both. When neither is set the task falls back to the
default source directory ("src/test/resources/features")
relative to the project directory.
When getTrackProgress() is enabled, every scenario is classified as
listed, defined, or implemented by cross-referencing its
steps against the step definitions found in getGlueCodeDirs().
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()Task action: collects.featurefiles, parses scenarios, and writes them to the configured AsciiDoc output file.abstract org.gradle.api.file.ConfigurableFileCollectionDirectories containing the Cucumber-JVM glue code (step definitions).abstract org.gradle.api.provider.Property<Boolean> Whether to group scenarios by their enclosingFeatureinstead of a flat list.abstract org.gradle.api.provider.Property<Boolean> Whether to recursively scan sub-directories of every directory ingetSourceDirs().abstract org.gradle.api.provider.Property<IndexingMode> Whether - and how - to numberFeature/Scenariotitles directly in the source.featurefiles.abstract org.gradle.api.file.DirectoryPropertyDirectory where the generated AsciiDoc file will be written.abstract org.gradle.api.provider.Property<String> Name of the generated AsciiDoc file (without path).abstract org.gradle.api.file.DirectoryPropertyRoot directory of the project, used to resolve the default source directory when neithergetSourceDirs()norgetSourceFile()is set.abstract org.gradle.api.file.DirectoryPropertyDirectory that report snippets (listed.adoc/defined.adoc/implemented.adoc) are written to whengetTrackProgress()istrue.abstract org.gradle.api.file.ConfigurableFileCollectionSource directories containing the.featurefiles to process.abstract org.gradle.api.file.RegularFilePropertyOptional single.featurefile to process.abstract org.gradle.api.provider.Property<String> Version of the system under test that the reported Gherkin scenarios exercise, printed in the generated document as e.g.abstract org.gradle.api.file.RegularFilePropertyOptional Mustache template used to render the report so that it references the snippets viainclude::directives instead of embedding their content verbatim.abstract org.gradle.api.provider.Property<Boolean> Whether to classify scenarios aslisted,defined, orimplementedand include a progress summary in the generated AsciiDoc.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
GenerateFeatureDocsTask
@Inject public GenerateFeatureDocsTask()Creates a new task instance. Invoked by Gradle's dependency injection infrastructure.
-
-
Method Details
-
getSourceDirs
@InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getSourceDirs()Source directories containing the.featurefiles to process. One or more directories may be configured. Mutually exclusive withgetSourceFile().- Returns:
- mutable file collection of feature file source directories
-
getSourceFile
@Optional @InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getSourceFile()Optional single.featurefile to process. Mutually exclusive withgetSourceDirs().- Returns:
- mutable file property for a single feature file
-
getIncludeSubDirs
Whether to recursively scan sub-directories of every directory ingetSourceDirs().- Returns:
- mutable boolean property controlling recursive directory scanning
-
getOutputDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getOutputDir()Directory where the generated AsciiDoc file will be written.- Returns:
- mutable directory property for the output directory
-
getOutputFileName
Name of the generated AsciiDoc file (without path).- Returns:
- mutable string property for the output file name
-
getTrackProgress
Whether to classify scenarios aslisted,defined, orimplementedand include a progress summary in the generated AsciiDoc.- Returns:
- mutable boolean property controlling progress tracking
-
getGlueCodeDirs
@InputFiles @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getGlueCodeDirs()Directories containing the Cucumber-JVM glue code (step definitions). One or more directories may be configured. Required whengetTrackProgress()istrue.- Returns:
- mutable file collection of glue code directories
-
getGroupByFeature
Whether to group scenarios by their enclosingFeatureinstead of a flat list. WhengetTrackProgress()istrue, grouping additionally splits report snippets by feature (seegetSnippetDir()).- Returns:
- mutable boolean property controlling grouping by feature
-
getSnippetDir
@OutputDirectory public abstract org.gradle.api.file.DirectoryProperty getSnippetDir()Directory that report snippets (listed.adoc/defined.adoc/implemented.adoc) are written to whengetTrackProgress()istrue.- Returns:
- mutable directory property for the snippet output directory
-
getTemplate
@Optional @InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getTemplate()Optional Mustache template used to render the report so that it references the snippets viainclude::directives instead of embedding their content verbatim. Only consulted whengetTrackProgress()istrue; ignored otherwise.- Returns:
- mutable file property for the Mustache template file
-
getSystemUnderTestVersion
Version of the system under test that the reported Gherkin scenarios exercise, printed in the generated document as e.g.System Under Test version: v1.0.0.- Returns:
- mutable string property for the system-under-test version
-
getIndexing
Whether - and how - to numberFeature/Scenariotitles directly in the source.featurefiles. Only allowed whengetIncludeSubDirs()istrue; whengetGroupByFeature()isfalse, onlyIndexingMode.OFFandIndexingMode.SCENARIOare allowed.- Returns:
- mutable property for the indexing mode
-
getProjectDirectory
@Internal public abstract org.gradle.api.file.DirectoryProperty getProjectDirectory()Root directory of the project, used to resolve the default source directory when neithergetSourceDirs()norgetSourceFile()is set.- Returns:
- mutable directory property for the project root directory
-
generate
public void generate()Task action: collects.featurefiles, parses scenarios, and writes them to the configured AsciiDoc output file.
-