This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Getting Started
Marián Labuda edited this page Apr 13, 2017
·
41 revisions
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
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.
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());
}
}
To run a test, open context menu Run As -> RedDeer Test on a project: