Hello Team,
I am migrating my performance tests on Kotlin.
I have the following code on Scala language:
class CustomActionBuilder(name: String, func: () => Status) extends ActionBuilder {
override def build(ctx: ScenarioContext, next: Action): Action =
new CustomAction(name, ctx.coreComponents.statsEngine, func, next)
}
class CustomAction(val name: String,
val statsEngine: StatsEngine,
func: () => Status,
val next: Action)
extends Action {
override def execute(session: Session): Unit = {
val startTime = System.currentTimeMillis
val status = try {
func()
} catch {
case _: Throwable =>
KO
}
val endTime = System.currentTimeMillis
statsEngine.logResponse(session.scenario, List.empty, name, startTime, endTime, status, None, None)
next ! session
}
}
By this code, I would like to have the ability to create AWS Gatling lambda and execute requests to the lambda or check the data in DB
.exec(lambda.sendStopRequest()) etc
Ps: my class is based on https://www.programcreek.com/scala/io.gatling.core.action.builder.ActionBuilder
my questions:
1 how I can implement this logic on JavaDsl, probably i should use io.gatling.javaapi.core.ActionBuilder?
2 what’s the best way to do it?
3 do you have a code example?