Skip to content

xored/rcptt.extensions.ecl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

See Development Environment Setup Guide in the docs/dev-guide.md file

Custom commands overview

This repository is a complete example on how to create a custom ECL command and use it in RCPTT.

The challenge with custom ECL commands is that they should be executed inside an application under test, therefore they have to be installed into it. However making a custom build for tests or including these extra plug-ins and dependencies into a final product is not desired. As a solution, RCPTT has mechanism to automatically include extra dependencies into an application-under-test – in RCPTT IDE this can be done by wrapping an update site into a special plug-in, which can be installed into RCPTT IDE itself.

This example shows a sample Maven build, which allows to build a runtime update site for RCPTT IDE in a single Tycho build, and can be used as a starting point for creating custom application-specific commands.

As an example, we create custom ECL commands:

  • get-problem-messages, which returns all error messages from Problems view (more precisely, it searches for all resource markers with type ‘problemmarker’ and gets and error messages from them)
  • get-supported-devices, which returns EclList of EclMap with information about devices
  • jfx-click-button, which clicks on a JavaFX button
  • jfx-select-pin, which selects a JavaFX control

Combined with other ECL commands, get-problem-messages command can be used to assert that there are no errors in Problems view, like this:

get-problem-messages | length | eq 0 | assert-true "There are build problems"

Or it can be used to assert that a Problems view contains a certain message:

// here we use 'foreach' as a filter --
// it returns only those elements, which match
// to a condition inside an 'if' statement
get-problem-messages | foreach [val msg] {
	if [$msg | invoke contains "Foo cannot be resolved to a type"] {
		$msg
	}
} | length | gt 0 | assert-true "Expected problem not found"

Structure

A custom command is split into two plug-ins:

  • org.eclipse.rcptt.extensions.ecl.model, which holds a EMF model for a command
  • org.eclipse.rcptt.extensions.ecl.impl, which contains a Java implementation for a command

This separation is not strictly required, but very convenient – in case of a custom application-specific ECL command only an implementation plugin has a dependency on an application plug-ins, so model plug-in can be added to RCPTT IDE in order to provide completion and documentation.

A repository is structured as following:

  • common
    • plug-in with a command model
    • feature, which consists of this plug-in only
  • runtime
    • plug-in with a command implementation
    • feature, which includes implementation plug-in and a common feature
    • repository, which provides runtime feature
  • ide
    • plug-in, which holds a binary runtime repository (it is automatically copied inside a plug-in during maven build)
    • feature, which includes ide plug-in and a common feature
    • repository, which provides IDE feature
  • tests
    • rcptt.extensions.ecl.tests, which contains sample RCPTT tests
    • rcptt.extensions.ecl.get-devices-tests, which contains sample test with get-supported-devices command
    • rcptt.extensions.ecl.jfx-tests, which contains sample test with JavaFX commands

Usage

Use mvn clean install -Dtycho.localArtifacts=ignore in repository root to build Runtime and IDE update sites. After that IDE update site can be installed into RCPTT from ide/repository/org.eclipse.rcptt.extensions.ide.site/target/repository. Note that for optimization purposes RCPTT IDE does not check for new injections for existing AUTs, so it is required to remove and add back an AUT in RCPTT after installing/updating RCPTT IDE extensions.

To run sample test cases using custom command, use mvn clean install in root of any project in /tests folder.

How to use custom commands in your project

To add external dependencies for the plugin with commands implementation, add this dependencies to root pom.xml file.

To inject the custom ecl commands to the AUT, add to your pom.xml a link to the runtime update site (for additional information, see ‘Injections’ section in RCPTT Documentation). For each project in /tests folder it looks as follows:

<injections>
	<injection>
	<site>${project.baseUri}../../runtime/repository/org.eclipse.rcptt.extensions.runtime.site/target/repository</site>
	</injection>
</injections>

About

Sample ECL commands to extend Q7 functionality

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published