[
https://issues.jboss.org/browse/ARQ-1828?page=com.atlassian.jira.plugin.s...
]
Moinz Moinzen commented on ARQ-1828:
------------------------------------
A Junit Rule would also make it a lot easier to make some default setup, and then allowing
the individual tests to add further information.
Example:
{code:java}
private static class MyTestRule implements TestRule {
ArquillianTestRule arquillianTestRule = new ArquillianTestRule();
private final WebArchive warModule = ShrinkWrap.create(WebArchive.class,
"test.war")
.addPackages(true,
"some.default.package")
.addAsManifestResource("MANIFEST.MF")
.addAsWebResource(EmptyAsset.INSTANCE,
"beans.xml")
.addClass(ServerUserContext.class);
private final JavaArchive beansModule =
ShrinkWrap.create(JavaArchive.class).addClass(ApiProducer.class);
public void addWarClass(Class clazz) {
warModule.addClass(clazz);
}
@Override
public Statement apply(Statement base, Description description) {
arquillianTestRule.setArchive(ShrinkWrap.create(EnterpriseArchive.class,
"test.ear")
.addAsModule(warModule)
.addAsModule(beansModule));
return arquillianTestRule.apply(base, description);
}
}
{code}
Usage:
{code:java}
public class MyTest {
@Rule
MyTestRule rule = new MyTestRule();
@Setup
public void setup(){
rule.addWarClass(MyOtherClass.class);
}
@Test
public void myTest() {
//Go!
}
}
{code}
Replace Testrunner with a JUnit-Rule
------------------------------------
Key: ARQ-1828
URL:
https://issues.jboss.org/browse/ARQ-1828
Project: Arquillian
Issue Type: Feature Request
Reporter: Niels Niels
At the moment all tests must run with
@RunWith(Arquillian.class)
This makes trouble if you need a runner with add or remove tests like Parameterized. I
can't see what Arquillian.class do which can not be done with a JUnit-Rule.
JUnit-Rules can be easily combined.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)