Skip to content

Instantly share code, notes, and snippets.

@wfouche
Created February 12, 2026 20:17
Show Gist options
  • Select an option

  • Save wfouche/280ce4339d28c4d28074bcde687be9fe to your computer and use it in GitHub Desktop.

Select an option

Save wfouche/280ce4339d28c4d28074bcde687be9fe to your computer and use it in GitHub Desktop.
APIUser.kt
//KOTLIN 2.2.21
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import io.github.wfouche.tulip.user.HttpUser
class APIUser : HttpUser() {
// Action 1: GET /posts
override fun action1(): Boolean {
val response = httpGet("/posts")
return response.isSuccessful()
}
// Action 2: POST /posts
override fun action2(): Boolean {
val payload: String = """
{
"title": "Tulip Test Post",
"body": "This is a test post created during load testing",
"userId": 1
}
""".trimIndent()
val response = httpPost(payload, "/posts")
return response.isSuccessful()
}
// Action 3: GET /posts/{id}
override fun action3(): Boolean {
val post_id = 1
val response = httpGet("/posts/{id}", post_id)
return response.isSuccessful()
}
override fun logger(): Logger {
return logger
}
companion object {
// Logger
private val logger: Logger = LoggerFactory.getLogger(APIUser::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment