hi, i’m new with this tools
i tried to make a test case in this website Execute Automation
what i want to know, is there any possible to make a test case for check input length in username like if the char input >40 i want to show message error
what should i do ?
i type the username and then i get the value or what ?
//lets say you will going to use this string value as your input
String input = "qweasdzxcqweasdzxc"
//check if >40
Assert.assertTrue(input.length() < 40)
/**
if > 40 the test will stop and will give you a failed result
else test will continue
**/
//OR
if (input.length() < 40)
{
WebUI.setText(findTestObject("your_input_field"), input)
}
else
{
//throw your error
}
If that helps you, don’t forget to mark it as a solution to this problem or give a like for future users to use this as a reference if they encounter the same scenario. . .
String input = “admin”
Assert.assertFalse(input.length() > 3)
WebUI.setText(findTestObject(‘Page_Execute Automation/input_Login_UserName’), input)
/**
Checks or asserts should happen first before the event. . . . but depends on some cases...
You need to check if the condition is true or false before proceeding to the next step.
Works like an if / else statement because it compares and accept bool values but it is compressed into a one-liner code.
**/