Class KarateFeatureBuilder

java.lang.Object
io.karatelabs.gatling.KarateFeatureBuilder
All Implemented Interfaces:
io.gatling.javaapi.core.ActionBuilder, io.gatling.javaapi.core.exec.Executable

public final class KarateFeatureBuilder extends Object implements io.gatling.javaapi.core.ActionBuilder
Builder for creating Karate feature execution actions. Provides a fluent API for configuring a feature path, tags, and silent mode.

Example usage:

 // Basic usage
 karateFeature("classpath:features/cats.feature")

 // With tag selector (positional, matches v1 API)
 karateFeature("classpath:features/cats.feature", "@smoke")

 // With multiple tag selectors (AND-ed)
 karateFeature("classpath:features/cats.feature", "@smoke", "~@slow")

 // Silent mode for warm-up
 karateFeature("classpath:features/cats.feature").silent()
 

To run multiple features in sequence, chain .exec(...) calls on the Gatling scenario rather than passing multiple paths here.

  • Constructor Details

    • KarateFeatureBuilder

      public KarateFeatureBuilder(String path, String... tags)
      Create a builder for the given feature path with optional tag selectors.
      Parameters:
      path - feature file path (e.g., "classpath:features/cats.feature")
      tags - tag selector expressions (e.g., "@smoke", "~@slow") — varargs; multiple values are AND-ed together, commas within a value are OR
  • Method Details

    • tags

      public KarateFeatureBuilder tags(String... tagExpressions)
      Add tag filter expressions. Equivalent to passing tags to the constructor; additional calls append to the existing tag list (all AND-ed together).
      Parameters:
      tagExpressions - tag expressions like "@smoke", "~@slow"
      Returns:
      this builder
    • silent

      public KarateFeatureBuilder silent()
      Enable silent mode. In silent mode, results are not reported to Gatling's StatsEngine. Use this for warm-up scenarios.
      Returns:
      this builder
    • protocol

      public KarateFeatureBuilder protocol(KarateProtocol protocol)
      Set the protocol for URI pattern matching and name resolution. This is typically called internally by the DSL.
      Parameters:
      protocol - the KarateProtocol
      Returns:
      this builder
    • asScala

      public io.gatling.core.action.builder.ActionBuilder asScala()
      Specified by:
      asScala in interface io.gatling.javaapi.core.ActionBuilder