RCPTT – set a file from the workspace dynamically

I’m quite amazed how powerful RCPTT is!
https://www.eclipse.org/rcptt

Recently, I’ve encountered a problem. The task was to set the path of a file into the file selection dialog, but it should be independent of the currently used test system. The first try was to set the file directly, but the path is hardcoded:


set-dialog-result File "/home/testman/rcptt/HelloWorld.txt"
get-window -class WizardDialog | get-button "Select *.txt" | click

Hence, a better way is to clear the workspace and import the needed files into the workspace before running the tests. Therefore, a context can be created within RCPTT. The workspace is resolved by “workspace:/” in RCPTT. This could be a solution, cause the workspace is created independently – different systems, different locations. Hence, we could try:


set-dialog-result File "workspace:/com.acme.rcptt/HelloWorld.txt"
get-window -class WizardDialog | get-button "Select *.txt" | click

But this won’t work. We should have a look at the ECL commands:

http://download.xored.com/q7/docs/ecl-api/latest

Instead, we can get the workspace location by using the ECL command “get-workspace-location” and concatenate it with the path to our file in the workspace:


set-dialog-result File [concat [get-workspace-location] "/com.acme.rcptt/HelloWorld.txt"]
get-window -class WizardDialog | get-button "Select *.txt" | click

Tadaaa, that’s it!

About Philip Wenig

Founder of OpenChrom
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to RCPTT – set a file from the workspace dynamically

Leave a comment