Skip to content

Instantly share code, notes, and snippets.

@wfouche
Created February 12, 2026 21:14
Show Gist options
  • Select an option

  • Save wfouche/9d203cf4090b7877f9da0a5f83ddf7fe to your computer and use it in GitHub Desktop.

Select an option

Save wfouche/9d203cf4090b7877f9da0a5f83ddf7fe to your computer and use it in GitHub Desktop.
APIUser.groovy
//GROOVY 5.0.4
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import io.github.wfouche.tulip.user.HttpUser
class APIUser extends HttpUser {
// Action 1: GET /posts
boolean action1() {
def response = httpGet("/posts")
response.successful
}
// Action 2: POST /posts
boolean action2() {
def payload = """
{
"title": "Tulip Test Post",
"body": "This is a test post created during load testing",
"userId": 1
}
"""
def response = httpPost(payload, "/posts")
response.successful
}
// Action 3: GET /posts/{id}
boolean action3() {
def postId = 1
def response = httpGet("/posts/{id}", postId)
response.successful
}
Logger logger() {
elog
}
private static final Logger elog = LoggerFactory.getLogger(APIUser)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment