Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » [SOLVED] Help understanding Workspace Contexts and Test Case autonomy
icon5.gif  [SOLVED] Help understanding Workspace Contexts and Test Case autonomy [message #1554698] Fri, 09 January 2015 10:51 Go to next message
Chris Champion is currently offline Chris ChampionFriend
Messages: 49
Registered: February 2014
Member
I'm having trouble figuring out how to implement Workspace Contexts so that each of my Test Cases can run autonomously.

I've been able to implement some other Contexts (Workbench, Parameters, Ecl Script) succesfully and have read all the of documentation I could find but feel like I'm missing out on a very powerful feature of RCPTT that might solve some headaches.

From here: https://www.eclipse.org/rcptt/documentation/userguide/contexts/
Quote:
With RCPTT Contexts there is no need to write any set-up and clean-up code; moreover, they represent reusable units of code which can be included in different test cases. It increases test base maintainability, resolving the task of AUT setup

Quote:
RCPTT lets you have Independent test cases, without any efforts. What is important, RCPTT test cases do not require AUT to be in the base state, letting you to start any test case from any AUT state. Contexts are responsible to bring AUT to the state required for the particular test execution.


https://www.eclipse.org/rcptt/documentation/userguide/contexts/workspace/
Quote:
The Workspace Context contains projects and files you need to place on your workspace before running your test....
Otherwise it verifies that all of its items are present in the workspace and have the same properties. If not, it creates missing items or replaces modified items correspondingly.


I've recorded about 150 Test Cases, one-after-another, and am sometimes seeing problems where one Test Case fails to create a tree object (e.g. an unexpected error occurs) and then some following Test Cases fail because they can't find the appropriate object in the tree.

Other than manually writing if-else and try-catch clauses for each Test Case to see if an item exists/does not exist, can I use a Context to check this at the beginning of the Test Case and act accordingly before executing the Test Case's script?

The tree class is: org.eclipse.swt.widgets.Tree

Any help or advice would be greatly appreciated.

Best regards,
Chris

[Updated on: Wed, 30 September 2015 08:23] by Moderator

Report message to a moderator

Re: Help understanding Workspace Contexts and Test Case autonomy [message #1559706 is a reply to message #1554698] Mon, 12 January 2015 06:38 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Hello,

Quote:

I'm having trouble figuring out how to implement Workspace Contexts so that each of my Test Cases can run autonomously.

You can use WorkSpace context to prepare your application for the test executing. Add to AUT workspace all required during test case execution projects and files including mentioned tree, create workspace context and capture content of AUT workspace by clicking Capture. Then add this context to test. It is useful to add appropriate workspace context to each test case.
Did you do it? What exact problem do you have with workspace contexts?

Quote:
I've recorded about 150 Test Cases, one-after-another, and am sometimes seeing problems where one Test Case fails to create a tree object (e.g. an unexpected error occurs) and then some following Test Cases fail because they can't find the appropriate object in the tree.

In order to isolate the root cause of the problem could you please provide me with some additional details.
Please send me following files after executing test case which fails to create a tree object:
1. Console log. How to get it you can find here.
2. Execution details. Click Details in execution view and send content of appeared window.
3. ECL script which the error occurs on.


Yours sincerely,
Olga.
Re: Help understanding Workspace Contexts and Test Case autonomy [message #1561707 is a reply to message #1554698] Tue, 13 January 2015 08:50 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Let me please clarify it a bit. Workspace contexts can control only the state of your application workspace, i.e. which projects and files exist in it.

If the tree you are referring to does not reflect the state of your application workspace (i.e. your tree is not a Project/Package Explorer), then workspace contexts won't help here. However, you can use ECL contexts to ensure that required items exist before each test case. In this case the following construction is helpful:

try {
  get-tree | get-item "root/child-must-exist"
} -catch {
  // snippet to create an item manually, i.e.
  // get-tree | select "root" | get-menu "New child"...
}

note that you can have several "composable" ECL contexts, i.e. if you have an item A and item B and one test case which requires only item A, and another one which requires both items, you can have two ECL contexts one for A and one for B and then use only context for item A in first test case and both contexts in a second test case

Please let me know if you have any questions.


Yours sincerely,
Olga.
Re: Help understanding Workspace Contexts and Test Case autonomy [message #1613110 is a reply to message #1561707] Thu, 12 February 2015 12:12 Go to previous message
Chris Champion is currently offline Chris ChampionFriend
Messages: 49
Registered: February 2014
Member
Hi Olga,

It looks like since the tree I'm testing with isn't a Project/Package Explorer tree, I can't use a Context to specify which children/files exist (or don't). The try/catch scripts seem to be doing the trick though. Thank you!

Chris
Previous Topic:Taking a complex screenshot with RCPTT
Next Topic:[SOLVED] "Widget is disposed" error
Goto Forum:
  


Current Time: Sat May 11 23:57:29 GMT 2024

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

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

Back to the top