Class GlueCodeScanner

java.lang.Object
com.arc_e_tect.gradle.gherkin.glue.GlueCodeScanner

public class GlueCodeScanner extends Object
Scans a directory of Cucumber-JVM glue code (step definition source files) and extracts every @Given/@When/@Then step definition pattern as a compiled Expression.

Step definitions are matched with a regular expression over the raw source text rather than a full Java/Kotlin parser, since only the string literal passed to the annotation is needed. Both Cucumber Expressions and regular-expression step patterns are supported, since ExpressionFactory auto-detects which kind a given pattern is.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new GlueCodeScanner.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.cucumber.cucumberexpressions.Expression>
    scan(File glueCodeDir)
    Recursively scans glueCodeDir for step definition source files and returns every step pattern found as a compiled Expression.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GlueCodeScanner

      public GlueCodeScanner()
      Creates a new GlueCodeScanner.
  • Method Details

    • scan

      public List<io.cucumber.cucumberexpressions.Expression> scan(File glueCodeDir)
      Recursively scans glueCodeDir for step definition source files and returns every step pattern found as a compiled Expression.
      Parameters:
      glueCodeDir - directory containing the glue code source files
      Returns:
      step definition patterns found across all source files; patterns that cannot be compiled are skipped and logged as a warning