Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Getting Started

rawagner edited this page Apr 12, 2017 · 41 revisions

Step 1 - Install RedDeer to Eclipse IDE

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

http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/

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 create Example test 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.jboss.reddeer.eclipse.jdt.ui.wizards.JavaProjectWizard;
import org.jboss.reddeer.eclipse.jdt.ui.wizards.NewClassCreationWizard;
import org.jboss.reddeer.eclipse.jdt.ui.wizards.NewClassWizardPage;
import org.jboss.reddeer.eclipse.jdt.ui.wizards.NewJavaProjectWizardPageOne;
import org.jboss.reddeer.eclipse.ui.views.markers.ProblemsView;
import org.jboss.reddeer.eclipse.ui.views.markers.ProblemsView.ProblemType;
import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.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();
		projectPage.setProjectName("testProject");
		projectDlg.finish();
		
		// Create Java class
		NewClassCreationWizard classDlg = new NewClassCreationWizard();
		classDlg.open();
		NewClassWizardPage classPage = new NewClassWizardPage();
		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:

Step 5 - Read the User documentation to learn more

Clone this wiki locally