Class StepContext

java.lang.Object
codes.grow.packages.skywalking.testing.StepContext

public final class StepContext extends Object
Everything an OpHandler needs for one step.
  • Method Details

    • scenario

      public Scenario scenario()
      Returns the running scenario.
      Returns:
      the scenario
    • step

      public Scenario.Step step()
      Returns the current step.
      Returns:
      the step
    • args

      public com.fasterxml.jackson.databind.JsonNode args()
      Returns the arguments with ${...} variables substituted (#{i} is kept).
      Returns:
      the arguments object
    • arg

      public String arg(String name)
      Returns a required string argument.
      Parameters:
      name - argument name
      Returns:
      the text value
      Throws:
      IllegalArgumentException - when missing
    • optArg

      public Optional<com.fasterxml.jackson.databind.JsonNode> optArg(String name)
      Returns an optional argument.
      Parameters:
      name - argument name
      Returns:
      the node, or empty
    • target

      public Object target()
      Returns the scenario target.
      Returns:
      the object the target factory created
    • target

      public <T> T target(Class<T> type)
      Returns the target cast to a type.
      Type Parameters:
      T - target type
      Parameters:
      type - expected class
      Returns:
      the target
    • substitute

      public String substitute(String text)
      Substitutes ${name} variables in a string.
      Parameters:
      text - text with placeholders
      Returns:
      the substituted text
    • variable

      public Optional<String> variable(String name)
      Returns a variable (run, prefix, serviceName or a saved name).
      Parameters:
      name - variable name
      Returns:
      the value, or empty