Details
-
Bug
-
Resolution: Done
-
Major
-
drone_2.0.0.Alpha5
-
None
Description
Consider these scenarios:
1)
@Deployment(name = "first", managed = false) public static Archive deployFirst() { return ShrinkWrap.create(WebArchive.class); } @Deployment(name = "second") public static WebArchive deploySecond() { return ShrinkWrap.create(WebArchive.class); } @ArquillianResource private Deployer deployer; @Drone @OperateOnDeployment("first") private WebDriver firstBrowser; @Drone @OperateOnDeployment("second") private WebDriver secondBrowser; @Test @InSequence(1) public void runFirstTest() throws InterruptedException { deployer.deploy("first"); firstBrowser.get("http://google.com"); deployer.undeploy("first"); } @Test @InSequence(2) public void runSecondTest() throws InterruptedException { secondBrowser.get("http://google.com"); }
2)
@Deployment(name = "deployment", managed = false) public static Archive deployFirst() { return ShrinkWrap.create(WebArchive.class); } @ArquillianResource private Deployer deployer; @Drone @OperateOnDeployment("deployment") private WebDriver browser; @Test @InSequence(1) public void runFirstTest() throws InterruptedException { deployer.deploy("deployment"); browser.get("http://google.com"); deployer.undeploy("deployment"); } @Test @InSequence(2) public void runSecondTest() throws InterruptedException { deployer.deploy("deployment"); browser.get("http://google.com"); deployer.undeploy("deployment"); }
both of them lead to the IllegalStateException:
java.lang.IllegalStateException: Injection point DronePointImpl{droneClass=interface org.openqa.selenium.WebDriver, annotations=[@org.jboss.arquillian.drone.api.annotation.Drone(), @org.jboss.arquillian.container.test.api.OperateOnDeployment(value=deployment)], lifecycle=DEPLOYMENT} has deployment lifecycle and has to be prepared in @BeforeClass. at org.jboss.arquillian.drone.impl.DroneTestEnrichHelper.ensureInjectionPointPrepared(DroneTestEnrichHelper.java:104) at org.jboss.arquillian.drone.impl.DroneTestEnrichHelper.enrichTestClass(DroneTestEnrichHelper.java:72) at org.jboss.arquillian.drone.impl.DroneTestEnricher.enrich(DroneTestEnricher.java:54) ...
The cause: the deployment-scoped drone point is destroyed before undeploy, but created only in BeforeClass. In the first test method the drone point is destroyed, however before the second test method is launched the test class is enriched including the drone point that is already destroyed.