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
Basic test requirement extensions
jbdevstudioqajenkins edited this page Jul 8, 2015
·
48 revisions
- CleanWorkspaceRequirement
It has very simple usage - just annotate test class with @CleanWorkspace annotation.
package org.jboss.reddeer.snippet.test;
import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.reddeer.requirements.cleanworkspace.CleanWorkspaceRequirement.CleanWorkspace;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(RedDeerSuite.class)
@CleanWorkspace
public class TestWithCleanWorkspaceRequirement {
@Test
public void testCase() {
// here goes logic
}
}
This simple example demonstrates cleaning workspace before test cases are executed.
- OpenPerspectiveRequirement
Similar applies to OpenPerspectiveRequirement. Annotate test class with @OpenPerspective(JavaPerspective.class) annotation and Java perspective will be opened prior to test case execution.
package org.jboss.reddeer.snippet.test;
import org.jboss.reddeer.eclipse.ui.perspectives.JavaPerspective;
import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(RedDeerSuite.class)
@OpenPerspective(JavaPerspective.class)
public class TestWithOpenPerspectiveRequirement {
@Test
public void testCase() {
// here goes logic
}
}
By default also Reset perspective command will be called for opened perspective. This can be disabled by setting reset parameter of the @OpenPerspective annotation to false.
@OpenPerspective(value=JavaPerspective.class , reset=false)
See also Writing minimal requirement, Requirements page and Test configuration page