Interface StepParameterProvider


public interface StepParameterProvider
SPI for providing constructor parameter values to step libraries created via @Steps.

Implementations are discovered via ServiceLoader. When Serenity creates a step library that has a constructor with parameters but no explicit parameter values were supplied, each registered provider is queried for each parameter type. If all parameters can be resolved, the step library is constructed with those values.

This enables modules like serenity-playwright to supply constructor arguments (e.g. a Playwright Page) without serenity-core having any compile-time dependency on those modules.

  • Method Summary

    Modifier and Type
    Method
    Description
    resolve(Class<?> type)
    Attempts to resolve a value for the given parameter type.
  • Method Details

    • resolve

      Optional<Object> resolve(Class<?> type)
      Attempts to resolve a value for the given parameter type.
      Parameters:
      type - the declared type of the constructor parameter
      Returns:
      an Optional containing the resolved value, or empty if this provider cannot supply the requested type