Created
February 12, 2026 21:14
-
-
Save wfouche/9d203cf4090b7877f9da0a5f83ddf7fe to your computer and use it in GitHub Desktop.
APIUser.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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