Untitled
unknown
javascript
4 years ago
3.6 kB
7
Indexable
import { sleep, group, check } from "k6";
import http from "k6/http";
export const options = {
stages: [
{ duration: "1m", target: 50 },
{ duration: "1m", tagget: 50 }
]
};
export default function main() {
const orderPayload = {
listCardType: "Visa",
txtCardNumber: "9999%209999%209999%209999",
listMonth: "01",
listYear: "2002",
"billAddr%24txtFirstName": "ABC",
"billAddr%24txtLastName": "XYX",
"billAddr%24txtAddress1": "901%20San%20Antonio%20Road",
"billAddr%24txtAddress2": "MS%20UCUP02-206",
"billAddr%24txtCity": "Palo%20Alto",
"billAddr%24listState": "Ca",
"billAddr%24txtZip": "94303",
"billAddr%24listCountry": "USA",
"billAddr%24txtPhone": "555-555-55",
chkShipBilling: "on",
}
const payload = JSON.stringify({
txtUserId: "DotNet",
txtPassword: "DotNet",
});
const header = {
"content-type": "application/x-www-form-urlencoded"
};
let response;
group("mspetshop - Get Sign In Page", function() {
response = http.get("http://mspetshop.com/MSPetShop/SignIn.aspx");
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Sign In", function() {
response = http.post("http://mspetshop.com/MSPetShop/SignIn.aspx", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Get Fish Category Page", function() {
response = http.get("http://mspetshop.com/MSPetShop/Category.aspx?categoryId=FISH", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Get Items from a category", function() {
response = http.get("http://mspetshop.com/MSPetShop/Items.aspx?productId=FI-FW-02", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Add item to cart", function() {
response = http.get("http://mspetshop.com/MSPetShop/ShoppingCart.aspx?itemId=EST-20", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Checkout", function() {
response = http.get("http://mspetshop.com/MSPetShop/Checkout.aspx", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Get Billing page", function() {
response = http.get("http://mspetshop.com/MSPetShop/OrderBilling.aspx", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Checkout", function() {
response = http.post("http://mspetshop.com/MSPetShop/OrderBilling.aspx", orderPayload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Send order", function() {
response = http.get("http://mspetshop.com/MSPetShop/OrderProcess.aspx", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
group("mspetshop - Sign out", function() {
response = http.get("http://mspetshop.com/MSPetShop/SignOut.aspx", payload, header);
check(response, {
"is status 200": (r) => r.status === 200
});
});
}Editor is loading...