Last active
February 10, 2026 07:46
-
-
Save wfouche/54d6076f5417b537fcb83ff11d1a64a9 to your computer and use it in GitHub Desktop.
Tulip User
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
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import io.github.wfouche.tulip.user.HttpUser; | |
| public class APIUser extends HttpUser { | |
| // Action 1: GET /posts | |
| public boolean action1() { | |
| var response = httpGet("/posts"); | |
| return response.isSuccessful(); | |
| } | |
| // Action 2: POST /posts | |
| public boolean action2() { | |
| String payload = """ | |
| { | |
| "title": "Tulip Test Post", | |
| "body": "This is a test post created during load testing", | |
| "userId": 1 | |
| } | |
| """; | |
| var response = httpPost(payload, "/posts"); | |
| return response.isSuccessful(); | |
| } | |
| // Action 3: GET /posts/{id} | |
| public boolean action3() { | |
| int post_id = 1; | |
| var response = httpGet("/posts/{id}", post_id); | |
| return response.isSuccessful(); | |
| } | |
| public Logger logger() { | |
| return logger; | |
| } | |
| // Logger | |
| private static final Logger logger = LoggerFactory.getLogger(APIUser.class); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment