Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » Clear Woskspace in Workspace Context does not clear it in Resource Navigator(Clear Woskspace in Workspace Context does not clear it in Resource Navigator)
Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695133] Tue, 12 May 2015 08:38 Go to next message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
Hi,

Whenever I launch my AUT using RCPTT application, it creates a directory just outside my RCPTT workspace as aut-<AUT_Name>, which it uses as workspace for AUT. I can use Clear Workspace option in Workspace context to remove everything inside this directory. Consider I have a resource created using my application inside this workspace, it deletes it whenever I do a clear workspace. But the problem I face is, it is not getting removed from the GUI, but only from the backend aut-<AUT_Name> directory.
Consider this scenario. I have a test case which need to open my application, create a resource in the resource navigator, which is created as a tree in my Resource Navigator tab of my application and also it is saved as a directory in my aut-<AUT_NAME>. Then I use a Verification to check if this tree information is valid in the way I created.

Hence whenever I want to replay this test, I need an empty workspace which means both Resource Navigator and aut-<AUT_Name> should not contain any information about my resource. I can use an the Clear Workspace option in Workspace context to remove the data in aut-<AUT_Name>. But it doesn't remove the data in Resource Navigator. However when I restart the application after I run my context to clear workspace, the Resource Navigator will be empty.

The problem is, Context runs only after the AUT gets launched. Hence the Clear Workspace runs only after RCPTT launches my AUT. Clear Context properly removes the content from aut-<AUT_Name> directory but it does not unlink the information from Resource Navigator. In my ECL Script, I will try to create a new resource of the same name, which will fail because in the Resource Navigator the resource already exist. It is deleted only inside aut-<AUT_Name> and not here.

This issue comes only when I try to create a test using RCPTT standalone application. Using TestRunner and Maven this issue does not appear. So, when I create a test, how can I overcome this difficulty? How can I delete the information in Resource navigator, it they exist before running my SCL Script? Kindly let me know.

Thank you
Jeevan
Re: Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695246 is a reply to message #1695133] Wed, 13 May 2015 03:54 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Hello,

Is it possible to synchronise Resource Navigator and AUT workspace from UI? Is there "Refresh" button or something like that?
Using TestRunner and Maven this issue doesn't appear because Runner creates new workspace before each build.
Try to add Workbench context with checked "reset perspective".
Please let me know if it is suitable for you.


Yours sincerely,
Olga.

[Updated on: Wed, 13 May 2015 03:57]

Report message to a moderator

Re: Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695253 is a reply to message #1695246] Wed, 13 May 2015 06:02 Go to previous messageGo to next message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
Hi Olga,

Reset Perspective did not help me. After Empty Workspace Context, I did a reset perspective, if the tree is in expanded mode, it shrinks into normal view even if the context is not in the workspace directory.

I do not have a rest or a restart option in my application.

I tried to create a ECL Script Context and tried, which also did not help much. I tried to make a if condition to find it the tree exist, and if exist we can delete the tree in Resource Navigator. The following is the code which I tried to write, but when the resource "abc" is not there, the code crashes in "get-item abc" in the "if" condition.

if [get-view "Resource Navigator" | get-tree | get-item abc | get-property caption | equals abc ] {
	get-view "Resource Navigator" | get-tree | select "abc/ip1/dsresource" | get-menu Delete | click
	with [get-window -class DeleteResourceDialog] {
    	get-button "Do you want to remove the physical files from the disk?" | check
    	get-button OK | click
	}
} 


Could you please help me in writing this test case? How can I frame this if condition?

Is it possible to create a new fresh workspace everytime when we run a test list?

You said that maven and testrunner creates a new aut-<AUT_Name> every time. If it runs in a new workspace, then everything will be new and it will be already empty. Then what is the point of having an option called "Empty Workspace"?

Thank you
Jeevan

[Updated on: Wed, 13 May 2015 08:51]

Report message to a moderator

Re: Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695276 is a reply to message #1695253] Wed, 13 May 2015 08:41 Go to previous messageGo to next message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
Hi,

I found a bigger problem which can't even be solved using maven or test runner. It is same as the one mentioned earlier, but only in reverse.

I created a resource in my Resource Navigator and went into aut-<AUT_Name> directory and saw that it has created a directory called "abc.ipname1-resource1/" which is my directory name. Then I copied this directory into another external directory outside aut-<AUT_Name> called Imports. Now I have another directory called "Imports/abc.ipname1-resource1/".

Now I created a Workspace Context, unchecked "Clear Workspace" and gave Import option and pointed it to "Imports/abc.ipname1-resource1/". Hence everytime when this context get invoked, the project in "Imports/abc.ipname1-resource1/" needs to get loaded into my Resource Navigator.

But when I run the Context in an empty aut-<AUT_Name> workspace, the files in "Imports/abc.ipname1-resource1/" gets copied into "aut-<AUT_Name>/abc.ipname1-resource1/" directory but not visible in the context. Hence when I do an action from my script, the test fails because Resource Navigator is initially now empty.

I have also tried the option like Capture current workspace Resource Navigator information using Workspace context which also did a similar thing.

In short my workspace directory and resource navigator does not sync.

How can i solve this? It seems almost pointless in having a context with this test case for me. Kindly let me know.

Thank you
Jeevan

[Updated on: Wed, 13 May 2015 08:52]

Report message to a moderator

Re: Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695408 is a reply to message #1695276] Thu, 14 May 2015 09:32 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Hello,

Apparently Resource Navigator doesn't recognise changes in workspace directory. This is the root cause of the both issues.
As a workaround I may suggest you to use the following ECL script:

proc "has-item" [val tree -input] [val titem] {
       try {
               $tree | get-item $titem
               bool true // return true
       } -catch {
               bool false // return false
}
}

if [get-view "Resource Navigator" | get-tree | has-item abc]{
get-view "Resource Navigator" | get-tree | select "abc/ip1/dsresource" | get-menu Delete | click
	with [get-window -class DeleteResourceDialog] {
    	get-button "Do you want to remove the physical files from the disk?" | check
    	get-button OK | click
	}
} -else {
log "abc item doesn't exist"
}


Copy that script to ECL context and add to Test Cases.
This script also can be modified for Import.
Please try and let me know if it is suitable for you.

Quote:
You said that maven and testrunner creates a new aut-<AUT_Name> every time. If it runs in a new workspace, then everything will be new and it will be already empty. Then what is the point of having an option called "Empty Workspace"?


I mean it creates new workspace at launching of runner, if there are several test cases, it would create new workspace just before execution of the first test case.


Yours sincerely,
Olga.
Re: Clear Woskspace in Workspace Context does not clear it in Resource Navigator [message #1695761 is a reply to message #1695408] Tue, 19 May 2015 05:37 Go to previous message
Jeevan Rex is currently offline Jeevan RexFriend
Messages: 80
Registered: March 2015
Location: Bangalore
Member
Hi,

The Code works. Thank you.

When a context runs, let us say we do a "Clear Workspace", how does that work? Apart from deleting those files from workspace directory, what other features does it include? How does the Context internally function with regarding Object deletion in Project manager? What are the internal Eclipse API calls it does? Similarly the Import function in Context, what are the internal API calls they use?

The ECL code you gave brings the GUI and does it as a ECL Script Context. How can I do the same by calling the Java method? Can I use a invoke call? I have the following,

WorkspaceManager wrkmgr;
// initialize wrkmgr
wrkmgr.deleteResource(resId, true) // where resId is of datatype QResourceID


How can I pass resId into invoke method? Can I use something similar to
get-eclipse-window | get-object | invoke com.abc.qti.qsip.core.ABCWorkspaceManager.WorkspaceManager.deleteResource "abc.ipname-resource" true //where "abc.ipname-resource" is resID object which I have to see how to pass. 


Thank you
Jeevan

[Updated on: Wed, 20 May 2015 10:58]

Report message to a moderator

Previous Topic:How to get items from table whem item names changes in each execution
Next Topic:File Import script non platform dependent
Goto Forum:
  


Current Time: Thu Apr 25 09:16:16 GMT 2024

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

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

Back to the top