-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
570e354
commit 8cdf5ec
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import http from 'k6/http'; | ||
import {sleep, check} from 'k6'; | ||
|
||
import { randomString } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '5s' | ||
} | ||
|
||
const baseUrl = "https://test-api.k6.io"; | ||
|
||
export default function(){ | ||
const randomUsername = randomString(16); | ||
|
||
const requestBody = JSON.stringify({ | ||
"username": randomUsername, | ||
"first_name": "John", | ||
"last_name": "Doe", | ||
"email": randomUsername+"@gmail.com", | ||
"password": "123123123" | ||
}); | ||
|
||
const params = { | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
const resp = http.post(`${baseUrl}/user/register/`,requestBody,params); | ||
|
||
check(resp, { | ||
'status code 201': r => r.status === 201 | ||
}) | ||
|
||
console.log(resp); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import http from 'k6/http'; | ||
import {sleep, check} from 'k6'; | ||
|
||
// export const options = { | ||
// vus: 3, | ||
// duration: '5s' | ||
// } | ||
|
||
const baseUrl = "https://test-api.k6.io"; | ||
|
||
export default function(){ | ||
|
||
const resp = http.get(`${baseUrl}/public/crocodiles/`); | ||
check(resp, { | ||
'status code 200': r => r.status === 200 | ||
}) | ||
}; |