Skip to content
Dániel Segesdi edited this page Jun 1, 2016 · 18 revisions

Links

Troubleshooting

  • AUT Connection Error: <a feature project> does not exist
    • Close the mentioned project in your workspace
  • A test case fails indeterministically
    • Check for background jobs that can change any visible property, e.g. name or position
  • A test case fails because a section is not found in the Properties view
    • Focus is handled a bit differently when executing a test, so make sure to explicitly click on a newly created item before using a selection-dependent view

Guidelines of writing maintainable tests

Using the invoke-static command

There isn't any reliable documentation about this command, or how to use it, however it is referenced from the documentation.

There is a blog entry for the 1.5.2 RCPTT release which shows us how to use this command:

​proc "get-os" {
    invoke-static -pluginId "org.eclipse.core.runtime"
                  -className "org.eclipse.core.runtime.Platform"
                  -methodName getOS
}

proc "print-os" [val os] {
    switch $os
        [case "win32" {
            log "current OS is Windows"
        }]
        [case "linux" {
            log "current OS is Linux"
        }]
        [case "macosx" {
            log "current OS is Mac OS X"
        }]
        -default {
            log [format "Unknow os: %s" $os]
        }
}
 
print-os [get-os]

The problem with this is that the ECL "documentation" states that the argumets are Strings, including the method name, so the lack of quotes might be a typo in the example.

This documentation also shows us that there is a fourth argument -args which we can use to pass arguments (Java Objects) to the java method. Further research showed that the -args keyword is used to pass a single argument, and it has to be added before each argument.

proc "test" [val parent] [val name] {
    invoke-static -pluginId "org.exemple"
                  -className "org.exemple.ClassName"
                  -methodName "methodName"
                  -args $parent
                  -args $name
}

Issues with Java Objects in RCPTT tests

RCPTT passes around ControlHandler wrapper objects instead of simple EditParts or Widgets, and we can use the get-object command to get the underlying object. The problem is that the only thing we can do with this object is instantly pass it into another command (with a pipe), or invoke a method on it. It cannot be assigned to a variable (when, let, procedure call), because RCPTT fails with exception (it does not know how to box the object). This is both a problem when trying to pass an object to a static method as a parameter and when trying to use a return value of such method.

Clone this wiki locally