-
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
6775b7b
commit a0e4668
Showing
7 changed files
with
90 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,16 @@ | ||
import http from 'k6/http'; | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '3s', | ||
}; | ||
|
||
const usernames = ['user1','user3','admin']; | ||
const passwords = ['123123','qwerty','qweqweqwe']; | ||
|
||
export default function () { | ||
http.get('https://test-api.k6.io/public/crocodiles/'); | ||
let random = Math.floor(Math.random() * usernames.length); | ||
|
||
console.log(`username: ${usernames[random]}, psw: ${passwords[random]}`); | ||
} |
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,18 @@ | ||
import http from 'k6/http'; | ||
|
||
import papaparse from 'https://jslib.k6.io/papaparse/5.1.1/index.js'; | ||
|
||
const csvData = papaparse.parse(open('data.csv'), {header: true}).data; | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '3s', | ||
}; | ||
|
||
export default function () { | ||
http.get('https://test-api.k6.io/public/crocodiles/'); | ||
|
||
let random = Math.floor(Math.random() * csvData.length); | ||
|
||
console.log(`username: ${csvData[random].username}, psw: ${csvData[random].password}`); | ||
} |
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,4 @@ | ||
username,password | ||
user,123456 | ||
johndoe,qwerty | ||
admin,123qwe123 |
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,6 @@ | ||
{ | ||
"users": [ | ||
{ "username": "json_admin", "password": "123456" }, | ||
{ "username": "json_test", "password": "qwerty" } | ||
] | ||
} |
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,16 @@ | ||
import http from 'k6/http'; | ||
|
||
const jsonData = JSON.parse(open('./data.json')).users; | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '3s', | ||
}; | ||
|
||
export default function () { | ||
http.get('https://test-api.k6.io/public/crocodiles/'); | ||
|
||
let random = Math.floor(Math.random() * jsonData.length); | ||
|
||
console.log(`username: ${jsonData[random].username}, psw: ${jsonData[random].password}`); | ||
} |
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,20 @@ | ||
import http from 'k6/http'; | ||
import {SharedArray} from 'k6/data'; | ||
|
||
const sharedData = new SharedArray("Shared Credentials", function(){ | ||
let data = JSON.parse(open('./data.json')).users; | ||
return data; | ||
}) | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '3s', | ||
}; | ||
|
||
export default function () { | ||
http.get('https://test-api.k6.io/public/crocodiles/'); | ||
|
||
let random = Math.floor(Math.random() * sharedData.length); | ||
|
||
console.log(`username: ${sharedData[random].username}, psw: ${sharedData[random].password}`); | ||
} |
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,10 @@ | ||
import http from 'k6/http'; | ||
|
||
export const options = { | ||
vus: 3, | ||
duration: '3s', | ||
}; | ||
|
||
export default function () { | ||
http.get('https://test-api.k6.io/public/crocodiles/'); | ||
} |