Skip to content

Latest commit

 

History

History
 
 

gatling-kt-ext

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Gatling-KT-Ext

Unholy Kotlin extensions to the Gatling Java API.

Async-await and generic code execution in your Java/Kotlin Gatling tests.

Most importantly, mutable builder syntax if you write your tests in Kotlin.

Mutable Builder Syntax

Instead of using Gatling's method chaining, you can use the mutable builder syntax, which is idiomatic in Kotlin, to write your tests.

ChainBuilder search =
    exec(http("Home").get("/"))
        .pause(1)
        .feed(feeder)
        .exec(
            http("Search")
                .get("/computers?f=#{searchCriterion}")
                .check(
                    css("a:contains('#{searchComputerName}')", "href").saveAs("computerUrl")
                )
        )
        ...

Source

import com.github.phisgr.gatling.kt.*

val search = chain {
    +http("Home").get("/")
    +pause(1)
    +feed(feeder)
    +http("Search")
        .get("/computers?f=#{searchCriterion}")
        .check(
            css("a:contains('#{searchComputerName}')", "href").saveAs("computerUrl")
        )
    ...
}

Source

Note how the two http calls are in the same indentation level In the Kotlin code.