Created
December 19, 2023 11:10
-
-
Save leandroandrade/5ce6c1d32d46a260d4446a466d6bc465 to your computer and use it in GitHub Desktop.
This file contains 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
// k6 run sample-k6-getpost.js | |
import http from 'k6/http'; | |
import {sleep} from 'k6'; | |
export let options = { | |
insecureSkipTLSVerify: true, | |
noConnectionReuse: false, | |
stages: [ | |
{ duration: '1m', target: 10 }, | |
{ duration: '2m', target: 20 }, | |
{ duration: '1m', target: 0 }, | |
] | |
} | |
export default function () { | |
const params = { | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
}; | |
const payload = JSON.stringify({ | |
name: `User ${Math.random()}`, | |
email: `email${Math.random()}@exemplo.com`, | |
password: `password${Math.random()}`, | |
}); | |
http.batch([ | |
['POST', 'http://localhost:8080/', payload, params], | |
['GET', `http://localhost:8080/${Math.random()}`] | |
]); | |
sleep(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment