Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to get failed test cases in the middle.
How to get failed test cases in the middle. [message #1419795] Tue, 09 September 2014 05:08 Go to next message
Shwetali Dhumal is currently offline Shwetali DhumalFriend
Messages: 12
Registered: August 2014
Junior Member
Hi,

While execution if any test case fail in between then is their any way to get the status of the test case.

In my RCP application, i m trying to click on the button which is on the shell but if that button is not enable test case will fail and shell will remain active/Opened. So for the next test cases it become problem.

So what my question is how to close that shell, after failing the test case in between.

I want to know the status of the test case if it will fail...

do test case return something on failing??

Thanks in advance
Re: How to get failed test cases in the middle. [message #1419806 is a reply to message #1419795] Tue, 09 September 2014 05:31 Go to previous messageGo to next message
Mickael Istria - away until August 14th is currently offline Mickael Istria - away until August 14thFriend
Messages: 833
Registered: July 2009
Location: Grenoble, France
Senior Member

You should write a tearDown method annotated with @After which would be
responsible of cleaning the application after the tests.
--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Re: How to get failed test cases in the middle. [message #1419905 is a reply to message #1419806] Tue, 09 September 2014 08:30 Go to previous messageGo to next message
Shwetali Dhumal is currently offline Shwetali DhumalFriend
Messages: 12
Registered: August 2014
Junior Member
Hi mickael,

But if test is passing in my scenario, that shell will not be active/opened(Shell will close auotamatically) so in method with @after annotation if i try to write close shell code then it will throw WidgetNotFoundException.

Refer screenShot:

In this shell if i am trying to click on checkbox(Import Custom Pdf) and if that checkbox is not enable and test case will fail. Then time i need to click on Cancel button on shell. If test case is pass then no need to click on calcel button.



[Updated on: Tue, 09 September 2014 08:32]

Report message to a moderator

Re: How to get failed test cases in the middle. [message #1420818 is a reply to message #1419905] Wed, 10 September 2014 14:18 Go to previous messageGo to next message
Benjamin Ratiarisolo is currently offline Benjamin RatiarisoloFriend
Messages: 16
Registered: January 2010
Location: Paris, France
Junior Member
Hi,

You can encapsulate the code in your @After method within a try/catch block so that exceptions thrown by your clean-up code are trapped there.

We have a similar kind of code except that we try closing ALL opened dialogs/wizards after/before running a tests .


--
Benjamin Ratiarisolo
IBM ODM Decision Server Rules - Software Developer
IBM Software - France Lab
Re: How to get failed test cases in the middle. [message #1421209 is a reply to message #1420818] Thu, 11 September 2014 04:03 Go to previous messageGo to next message
Shwetali Dhumal is currently offline Shwetali DhumalFriend
Messages: 12
Registered: August 2014
Junior Member
Hi Benamin,

Thank you so much... It is working... Smile
Re: How to get failed test cases in the middle. [message #1421398 is a reply to message #1419795] Thu, 11 September 2014 10:10 Go to previous message
pawan garia is currently offline pawan gariaFriend
Messages: 39
Registered: February 2013
Member
You can do the Exception handling on Every Action you are performing.

And get the Message from the Exception in your Junit Test Case.

if you want to close all the Shells after Test Failure, you can try this code.

SWTBotShell[] Shell1 = bot.activeShell().bot().shells();
for( SWTBotShell shList1 : Shell1)
{
shList1.close();
}

}
Previous Topic:How to click a button under a CTabFolder?
Next Topic:Context menu in project explorer view.
Goto Forum:
  


Current Time: Tue Nov 13 16:26:04 GMT 2018

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

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

Back to the top