RedDeer Project
odockal Upversion to 2.4.0-SNAPSHOT
Signed-off-by: Ondrej Dockal <odockal@redhat.com>
Latest commit df4cd1d Sep 18, 2018

README.md

Eclipse RedDeer Testing Framework

Eclipse RedDeer project is an extensible framework used for development of automated SWT/Eclipse tests which interacts with application’s user interface. RedDeer provides the PageObjects API for comfortable testing of standard SWT (Buttons, Trees..), JFace (UIForms), Workbench (Views, Editors, ..) and Eclipse (Wizards, Preferences,...) components and also allows creating and extending your own components. RedDeer also provides capabilities to work with graphical editors based on GEF or Graphiti.

Eclipse RedDeer is extensively tested on 3 major platforms - Windows, MacOSX and Linux to ensure that all nuances in the SWT implementations are handled correctly. Examination of test results in CI environment is easier thanks to capturing screenshots on test failures and collecting Eclipse Platform log.

Documentation

see RedDeer Documentation

Contact us

Getting Started

Step 1 - Install RedDeer to Eclipse IDE

Copy-Paste this URL to Eclipse Help -> Install New Software...

http://download.eclipse.org/reddeer/releases/latest

Or latest nightly build

http://download.eclipse.org/reddeer/snapshots

Install at least RedDeer Runtime/API and RedDeer UI features.

Or you can also start with RedDeer Maven Archetype

Step 2 - Create a new RedDeer test project

To create a new RedDeer test project, navigate through workbench shell menu File -> New -> Other and select RedDeer - RedDeer Test Plug-in

When you fill out the required fields do not forget to check the Example test checkbox and click Finish.

Step 3 - Write and run your first test

This is the example test created by RedDeer wizard:

import static org.junit.Assert.*;

import org.eclipse.reddeer.eclipse.jdt.ui.wizards.JavaProjectWizard;
import org.eclipse.reddeer.eclipse.jdt.ui.wizards.NewClassCreationWizard;
import org.eclipse.reddeer.eclipse.jdt.ui.wizards.NewClassWizardPage;
import org.eclipse.reddeer.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne;
import org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView;
import org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView.ProblemType;
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.workbench.impl.editor.TextEditor;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * RedDeer Test example generated by RedDeer Test Plug-in wizard
 */
@RunWith(RedDeerSuite.class)
public class RedDeerTest {

	@Test
	public void redDeerTestExample() {
		
		// Create Java Project
		JavaProjectWizard projectDlg = new JavaProjectWizard();
		projectDlg.open();
		NewJavaProjectWizardPageOne projectPage = new NewJavaProjectWizardPageOne(projectDlg);
		projectPage.setProjectName("testProject");
		projectDlg.finish();
		
		// Create Java class
		NewClassCreationWizard classDlg = new NewClassCreationWizard();
		classDlg.open();
		NewClassWizardPage classPage = new NewClassWizardPage(classDlg);
		classPage.setName("RedDeerDemo");
		classPage.setPackage("org.reddeer.demo");
		classDlg.finish();
		
		// Edit Java class
		TextEditor textEditor = new TextEditor("RedDeerDemo.java");
		textEditor.setText("Written by RedDeer");
		textEditor.save();
		
		// Check ProblemsView
		ProblemsView problemsView = new ProblemsView();
		problemsView.open();
		assertFalse(problemsView.getProblems(ProblemType.ERROR).isEmpty());
	}
}

Step 4 - Test execution

To run a test, open context menu Run As -> RedDeer Test on a project:

Code Coverage

You can generate a code coverage for the whole project by

mvn clean verify -Pjacoco

which will execute all tests. The coverage results can be found at jacoco-result/target/site.

It is also possible to generate code coverage for one tests bundle. For examle

mvn clean verify -pl tests/org.eclipse.reddeer.common.test -am

which will execute only tests from org.eclipse.reddeer.common.test and generate the code coverage for org.eclipse.reddeer.common. Such results can be found at tests/org.eclipse.reddeer.common.test/target/site.