Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Error/Exception handling using SWTBot .
Error/Exception handling using SWTBot . [message #1013482] Sat, 23 February 2013 19:19
ajay shedge is currently offline ajay shedgeFriend
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."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.
Previous Topic:Where to get the SWTBot version for juno?
Next Topic:How to ues the EclipseSpy view on an Application?
Goto Forum:

Current Time: Sat Jun 23 14:29:32 GMT 2018

Powered by FUDForum. Page generated in 0.01704 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top