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
#!/bin/bash | |
## | |
# This is a sample bash script that shows how to run Loadster Workbench in "headless" mode | |
# for playing a load tests scenario from the command line. This may be useful in CI environments | |
# or any time you need to run tests on a schedule. | |
## | |
# Path to your Java Runtime Environment home | |
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home" |
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
// Capture the current 4-digit year | |
function capture(response) { | |
var date = new Date(); | |
return (date.getYear() + 1900).toFixed(0); | |
} |
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
function capture(response) { | |
var str = response.bodyAsString; | |
var lb = "<textarea name=\"description\">"; | |
var rb = "</textarea>"; | |
var startIndex = str.indexOf(lb) + lb.length; | |
var endIndex = str.indexOf(rb, startIndex); | |
return str.substring(startIndex, endIndex); | |
} |
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
// <cars> | |
// <car id="13"><make>Volkswagen</make><model>Thing</model></car> | |
// <car id="80"><make>Land Rover</make><model>Series IIA</model></car> | |
// </cars> | |
function capture(response) { | |
var xml = XML.parse(response.bodyAsString); | |
var cars = xml.childNamed('cars'); | |
return cars && cars.childrenNamed('car').length > 0; // Validation is successful if there was at least 1 car |
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
// {"books": [ | |
// {"id": 4, "name": "Slaughterhouse Five"}, | |
// {"id": 11, "name": "The Old Man and the Sea"}, | |
// {"id": 25, "name": "Don Quixote"} | |
// ]} | |
function validate(response) { | |
var json = JSON.parse(response.bodyAsString); | |
return json.books && json.books.length > 0; // Make sure at least one book was returned |
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
function validate(response) { | |
var regex = /Confirmation #AWB(\d{8})Z/gm; | |
var matched = regex.test(response.bodyAsString); | |
return matched; // Validation is successful if the regex matched | |
} |
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
function validate(response) { | |
var headers = response.getHeaders(); | |
console.log("The response has " + headers.size() + " headers"); | |
for (var i = 0; i < headers.size(); i++) { | |
var header = headers.get(i); | |
if (header.name == "Content-Type") { | |
if (header.value == "application/json") { |
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
// <users> | |
// <user id="1"><fullName>Hank Hill</fullName></user> | |
// <user id="2"><fullName>Peggy Hill</fullName></user> | |
// <user id="3"><fullName>Bobby Hill</fullName></user> | |
// </users> | |
function capture(response) { | |
var xml = XML.parse(response.bodyAsString); | |
var users = xml.childrenNamed("user"); |
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
// <users> | |
// <user id="1"><fullName>Hank Hill</fullName></user> | |
// <user id="2"><fullName>Peggy Hill</fullName></user> | |
// <user id="3"><fullName>Bobby Hill</fullName></user> | |
// </users> | |
function capture(response) { | |
var users = XML.parse(response.bodyAsString); | |
return users.childrenNamed("user")[2].attr["id"]; |
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
// <users> | |
// <user id="1"><fullName>Hank Hill</fullName></user> | |
// <user id="2"><fullName>Peggy Hill</fullName></user> | |
// <user id="3"><fullName>Bobby Hill</fullName></user> | |
// </users> | |
function capture(response) { | |
var users = XML.parse(response.bodyAsString); | |
return users.childrenNamed("user")[2].childNamed('fullName').val; // returns "Bobby Hill" |
NewerOlder