Package io.karatelabs.gatling
Class KarateSetBuilder
java.lang.Object
io.karatelabs.gatling.KarateSetBuilder
- All Implemented Interfaces:
io.gatling.javaapi.core.ActionBuilder,io.gatling.javaapi.core.exec.Executable
Builder for setting session variables for Karate features.
Variables set with this builder are available in Karate as __gatling.<key>.
Example usage:
scenario("Test")
.feed(feeder)
.exec(karateSet("userId", s -> s.getInt("id")))
.exec(karateFeature("classpath:features/user.feature"))
-
Constructor Summary
ConstructorsConstructorDescriptionKarateSetBuilder(String key, Function<io.gatling.javaapi.core.Session, Object> valueSupplier) Create a builder that sets a session variable. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.gatling.javaapi.core.ActionBuilder
toChainBuilder
-
Constructor Details
-
KarateSetBuilder
Create a builder that sets a session variable.- Parameters:
key- the variable namevalueSupplier- function to compute the value from the session
-
-
Method Details
-
toSessionFunction
public Function<io.gatling.javaapi.core.Session,io.gatling.javaapi.core.Session> toSessionFunction()Convert to a session function for use with Gatling's exec(). -
asScala
public io.gatling.core.action.builder.ActionBuilder asScala()- Specified by:
asScalain interfaceio.gatling.javaapi.core.ActionBuilder
-