Skip to main content



      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 01:08 Go to next message
Eclipse UserFriend
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 01:31 Go to previous messageGo to next message
Eclipse UserFriend
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 04:30 Go to previous messageGo to next message
Eclipse UserFriend
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 04:32] by Moderator

Re: How to get failed test cases in the middle. [message #1420818 is a reply to message #1419905] Wed, 10 September 2014 10:18 Go to previous messageGo to next message
Eclipse UserFriend
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 .
Re: How to get failed test cases in the middle. [message #1421209 is a reply to message #1420818] Thu, 11 September 2014 00:03 Go to previous messageGo to next message
Eclipse UserFriend
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 06:10 Go to previous message
Eclipse UserFriend
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: Sun May 11 21:26:47 EDT 2025

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

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

Back to the top