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
def custom_success_response(response, error_code_to_success): | |
error_name = "err" | |
if error_name in response.text: | |
err_code = response.json()[error_name] | |
if err_code == error_code_to_success: | |
response.success() | |
#In this example, when the web service returns 500, | |
# we considered it successful and did not reflect into the locust statistics. |
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
public class BasePage { | |
WebDriver driver; | |
WebDriverWait webDriverWait; | |
public BasePage(WebDriver driver){ | |
this.driver=driver; | |
this.webDriverWait = new WebDriverWait(driver,150); | |
} | |
public WebElement findElement(By by){ |
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
fun waitForElements(vararg elements: Matcher<View>) { | |
elements.forEach { | |
Matchers.allOf(it, isDisplayed()).waitForView() | |
} | |
} |
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
//run with the web UI | |
locust -f locust_files/my_locust_file.py | |
//run without the web UI ( u = user, r = spawn rate ) | |
locust -f my_locust_file.py --headless -u 1000 -r 100 | |
/setting a time limit for the test. --run-time or -t | |
locust -f --headless -u 1000 -r 100 --run-time 1h30m |
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
struct Cargo : Decodable{ | |
let title : String? | |
let desc : String? | |
let latitude: Double | |
let longitude: Double | |
} |
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
def custom_error_message(response, error_message_name): | |
error_name = "err" | |
if error_name in response.text: | |
err_code = response.json()[error_name] | |
if err_code != "0": | |
err_msg = response.json()[error_message_name] | |
response.failure(error_name + ':' + err_code + ',' + error_message_name + ':' + err_msg) |
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
fun getText(element: Matcher<View>): String { | |
return try { | |
privateGetText(element) | |
} catch (e: NoMatchingViewException) { | |
e.toString() | |
} | |
} | |
private fun privateGetText(matcher: Matcher<View>): String { | |
var text = String() |
NewerOlder