Skip to main content



      Home
Home » Eclipse Projects » RCP Testing Tool » "tear down" context for tests?(is there a tear down context for tests that runs *after* each test?)
"tear down" context for tests? [message #1710463] Tue, 06 October 2015 19:53 Go to next message
Eclipse UserFriend
Hi,
Is there a "context" that can be run *after* each testcase? All the contexts seem to run *before* the tests. I need the workspace to be completely clean before each test and the "Clear workspace" option in the Workspace Context does not actually clear the workspace (it only seems to clear Java projects which is not very useful for my tests)

Thanks for any info.
Re: "tear down" context for tests? [message #1710470 is a reply to message #1710463] Tue, 06 October 2015 23:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Gary,

No, all the contexts are executed before a test case thus preparing AUT to a desired state.

You could write your own ECL procedure where you manually clear a workspace as you need.
Anyway, I wouldn't do it at the end of the test, since in case the test fails somewhere in the middle, the procedure won't be called and all the following tests will be affected.

You can place a procedure into ECL Script Context for a convenience.

In case you insist on clearing workspace at the end of the test you could use the following workaround:

try -command {<your main test script>}
-finally {procedure call to clear workspace}

but again, I would use the first option - place procedure into ECL Script Context and use it before a test.

Kind regards,
Ulyana.
Re: "tear down" context for tests? [message #1710544 is a reply to message #1710463] Wed, 07 October 2015 08:53 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
I need the workspace to be completely clean before each test and the "Clear workspace" option in the Workspace Context does not actually clear the workspace (it only seems to clear Java projects which is not very useful for my tests)


Purpose of RCPTT's Workspace Context is to do *exactly* what you need. So I'd like to suggest not to search for workarounds, but to dig into the problem a little bit. Workspace Context shall remove all the resources, not only Java Projects.

However, if it is not there can be following things:

* Your resources can stay locked after test executed -> a problem in your software
* You are creating just plain files (not eclipse workspace resources) under eclipse workspace location -> improper use of eclipse workspace in your software.
* other reasons...

Which kind of resources and how do you create them so Workspace Context unable to wipe them out?

Thank you,
Andrey
Re: "tear down" context for tests? [message #1710574 is a reply to message #1710544] Wed, 07 October 2015 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Ulyana, Andrey - thank you for your suggestions. Andrey - the resources I need to clean are in a Remote System Explorer (Part of https://www.eclipse.org/tm/ ). I need to disconnect and remove remote systems which I create in the Script Context that runs before each test. I suppose I can check in the Script Context if there are any left over systems and disconnect and delete them but that seems like quite a bit of coding in ECL (that I just started learning Smile so I was looking or an easy way out. Workspace Context looked like that easy way out with the "Clear workspace" option but that option did not clear anything from the workspace for me. I don't think any resources are locked as such but I will continue looking.
Спасибо еще раз за помощь! / Thanks again for your help!
Re: "tear down" context for tests? [message #1710608 is a reply to message #1710574] Wed, 07 October 2015 16:44 Go to previous messageGo to next message
Eclipse UserFriend
I ended up duplicating the clean up code in each of my tests. It's not ideal but should work as long as we don't have too many tests to worry about. Ideally of course, it would be great if RCP TT provided ability to run *any* Script as a post-op.
This would be very similar to the "After" or "AfterClass" annotation in jUnits.

спасибо вам еще раз за быстрый ответ. До скорой.
Re: "tear down" context for tests? [message #1710614 is a reply to message #1710608] Wed, 07 October 2015 18:35 Go to previous message
Eclipse UserFriend
Apologies - one last update, I promise!

I think I figured this out and I think it works quite nicely so far for me. My "Tests" effectively become empty scripts.
All of my testing is done in the contexts that are driven by individual encapsulated scripts.

The flow goes approximately like this:
In my individual Test Contexts, I have the following list of contexts:

Global Setup parms (default context) 
Initialize Workbench (default context)
Initialize Workspace (default context)
Global Setup Script (default context)
My test parms (non-default context)
My test Setup Script (non-default context)
My ACTUAL TEST Script (non-default context)
My test Teardown Script (non-default context)
Global Teardown Script (non-default context)


All of these scripts and parms are re-usable and I parametrized most of the things used across scripts (although I'm still learning ECL).

And the actual Test script is just empty field as all of the work is done in the Contexts. I'm not sure if this is best practice but it works really nice with
encapsulation of various pieces and the Setup and Teardown capability that approaches that of a jUnit test.

Previous Topic:How to increase verbosity of recorder?
Next Topic:How to re-use ECL scripts across multiple projects?
Goto Forum:
  


Current Time: Thu Jun 19 19:04:28 EDT 2025

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

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

Back to the top