| Error/Exception handling using SWTBot . [message #1013482] |
Sat, 23 February 2013 14:19 |
ajay shedge Messages: 5 Registered: February 2013 |
Junior Member |
|
|
I need help with SWTBot for the below problem which i am facing from many days.
Please refer the attached screenshot. There are some fields in my application which has validations set in it. For eg
1. Db2 Administrator ID : Cannot start with number like (123456) or cannot be more than 8 characters.
2. Db2 Administrator Password : Cannot contain special characters,spaces,etc...

I have written below code which runs perfectly for all positive cases.
bot.radio("Use an existing installation of DB2").click();
bot.textWithLabel("Location *").setText("C:\\Program Files\\IBM\\db2");
bot.textWithLabel("DB2 Administrator ID *").setText("ajay");
bot.textWithLabel("DB2 Administrator Password *").setText("ajay");
bot.textWithLabel("Confirm Password *").setText("ajay");
bot.textWithLabel("Database Name *").setText("ajaydb");
bot.textWithLabel("DB2 Port *").setText("50000");
bot.button("Next >").click();
But when i try to run the same code for negative cases like below, the program abruptly terminates.
bot.textWithLabel("DB2 Administrator ID *").setText("12345678");
bot.textWithLabel("DB2 Administrator Password *").setText("aj ay");
I tried to use below try and catch but i need to know how do i capture the error message that is shown in the application using bot :
try {
bot.textWithLabel("DB2 Administrator ID *").setText("12345678");
} catch (Exception e) {
e.printStackTrace(); // i do not see any stack trace here
}
Which Bot Object should i use to capture the "error message that is displayed on the application". I need to test this fields with negative scenarios continuously.
Thanks in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.01740 seconds