Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Triquetrum/RCP testing"

(Configuring the Triquetrum AUT)
 
Line 37: Line 37:
  
 
Check the related [https://www.eclipse.org/rcptt/documentation/userguide/getstarted/ RCPTT docs] as well for more info.
 
Check the related [https://www.eclipse.org/rcptt/documentation/userguide/getstarted/ RCPTT docs] as well for more info.
 +
 +
==== Running the existing tests ====
 +
The ''tests'' folder contains the test definitions. Currently they test basic features of the Triquetrum graphical editor.
 +
The ''BasicTests'' suite can run all of them in one shot.
 +
 +
[[File:RCPTT_BasicTests.JPG|400px]]
 +
 +
You should now be able to run the BasicTests suite via the ''Run As > Test Cases'' context menu.
 +
This will ask you to select your Triquetrum AUT first and then launch Triquetrum and run all tests in sequence.
 +
 +
As RCPTT instruments the AUT, the initial startup takes some time, but after that you should see the consecutive editor actions rapidly being executed.
 +
The result should be all green, similar to :
 +
 +
[[File:RCPTT_BasicTests_Executed.JPG|400px]]
 +
 +
See the known issues at the bottom of this page : the createConnectedHelloModel may fail.
  
 
==== Creating new tests ====
 
==== Creating new tests ====
 +
TBD : explain using the recorder, how to set assertions on UI elements and/or underlying model entities && first intro to manipulating the ECL test script
 +
 +
==== Working with failed tests in RCPTT IDE ====
 +
TBD : using the details view, navigating to the location of the failure in the test script
  
 
=== Integrating in a maven build ===
 
=== Integrating in a maven build ===
Line 68: Line 88:
  
 
When that is ok, you can run a plain ''mvn clean verify'' in the project directory, and you should see lots of logging and then Triquetrum popping up with stuff happening in the editor etc!
 
When that is ok, you can run a plain ''mvn clean verify'' in the project directory, and you should see lots of logging and then Triquetrum popping up with stuff happening in the editor etc!
 +
 +
== Next steps ==
  
 
KNOWN issue : the test ''createConnectedHelloModel'' often fails in drawing the connection. It appears that the click/selection event often fails to pick the Constant.output port as start of the new connection. Instead the Graphiti context menu pops up. And then the test assertion fails that checks for the presence of the connection.
 
KNOWN issue : the test ''createConnectedHelloModel'' often fails in drawing the connection. It appears that the click/selection event often fails to pick the Constant.output port as start of the new connection. Instead the Graphiti context menu pops up. And then the test assertion fails that checks for the presence of the connection.
  
 
TODO : add it in our HIPP build, i.e. include it in the overall mvn build & change the AUT reference to the product build output folder.
 
TODO : add it in our HIPP build, i.e. include it in the overall mvn build & change the AUT reference to the product build output folder.

Latest revision as of 07:02, 1 July 2017

Automating RCP UI testing

As the Triquetrum editor is getting more features (e.g. repository view, dynamic palette etc) while we're still refactoring underlying elements and models, we need automated tests to prevent regression issues. With issue #249 an effort has started to implement such automated UI testing on Triquetrum's RCP workflow editor.

Eclipse RCPTT is already used by several projects of the science group (e.g. ChemClipse/OpenChrom) and with positive feedback. It promises GUI test automation for traditional RCP components and also GEF/Graphiti!

Some more info :

Getting started with RCPTT on Triquetrum

RCPTT can be used in two ways :

  • With the RCPTT IDE, test definitions are created & maintained as files in an Eclipse project.
  • The RCPTT maven plugin can be used to run tests in automated builds.

In both cases, a reference to the to-be-tested RCP application (Application Under Test a.k.a. AUT) must be configured. With the RCPTT IDE this typically means pointing to a local installation of a Triquetrum RCP. With the maven plugin it's possible to point to the product target folder where the build has stored its resulting product zip files. Other options to identify/locate the AUT are supported, check the RCPTT docs for more info on this.

Triquetrum UI tests in RCPTT IDE

Preparation

  1. You can download the RCPTT IDE for your environment from here. I've used the 2.3.0 build for Windows 64-bit.
  2. Create a Triquetrum build, or download it from the Triquetrum build server.
  3. Clone the Triquetrum repository
  4. Import the project tests/org.eclipse.triquetrum.rcptt.test in your RCPTT IDE workspace

Configuring the Triquetrum AUT

In the Applications tab of the RCPTT IDE, add a Triquetrum installed instance on your machine, via the New... menu.

RCPTT Add AUT1.JPG

After selecting the location on your disk, and letting RCPTT analyse the application for a while, you also must assign a name.

RCPTT Add AUT2.JPG

Then click Finish and you should have Triquetrum available for your testing.

Check the related RCPTT docs as well for more info.

Running the existing tests

The tests folder contains the test definitions. Currently they test basic features of the Triquetrum graphical editor. The BasicTests suite can run all of them in one shot.

RCPTT BasicTests.JPG

You should now be able to run the BasicTests suite via the Run As > Test Cases context menu. This will ask you to select your Triquetrum AUT first and then launch Triquetrum and run all tests in sequence.

As RCPTT instruments the AUT, the initial startup takes some time, but after that you should see the consecutive editor actions rapidly being executed. The result should be all green, similar to :

RCPTT BasicTests Executed.JPG

See the known issues at the bottom of this page : the createConnectedHelloModel may fail.

Creating new tests

TBD : explain using the recorder, how to set assertions on UI elements and/or underlying model entities && first intro to manipulating the ECL test script

Working with failed tests in RCPTT IDE

TBD : using the details view, navigating to the location of the failure in the test script

Integrating in a maven build

The pom.xml file in the project org.eclipse.triquetrum.rcptt.test can be used to run local maven test builds. To try this out, you need to change the AUT directory to what is applicable on your system, in the <explicit> element in the POM :

 <build>
   <plugins>
     <plugin>
       <groupId>org.eclipse.rcptt</groupId>
       <artifactId>rcptt-maven-plugin</artifactId>
       <version>${rcptt-maven-version}</version>
       <extensions>true</extensions>
       <configuration>
         <aut>
           <explicit>C:/temp/triquetrum/repository/triquetrum</explicit>
...

When that is ok, you can run a plain mvn clean verify in the project directory, and you should see lots of logging and then Triquetrum popping up with stuff happening in the editor etc!

Next steps

KNOWN issue : the test createConnectedHelloModel often fails in drawing the connection. It appears that the click/selection event often fails to pick the Constant.output port as start of the new connection. Instead the Graphiti context menu pops up. And then the test assertion fails that checks for the presence of the connection.

TODO : add it in our HIPP build, i.e. include it in the overall mvn build & change the AUT reference to the product build output folder.

Back to the top