Skip to content

API changes in Drone 2

Matous Jobanek edited this page Feb 2, 2016 · 2 revisions

API changes in Drone 2

Multiple Drone life cycle scopes

  • Class scoped life cycle

    • Drone will be prepared in the BeforeClass phase and destroyed in the AfterClass phase, resulting in a one instance for all tests.

    • This scope is a default scope for the field injection points. If you still want to declare the Drone point to be class-scoped use the annotation @ClassLifecycle

  • Deployment scoped life cycle

    • Drone will be prepared in the AfterDeploy phase and destroyed in the BeforeUnDeploy phase, resulting in a one instance for all tests belonging to a deployment.

    • To declare any injection point as a deployment-scoped Drone point use the annotation @OperateOnDeployment("deployment_name") with the specified name of the deployment the Drone point should be tied to:

      @RunWith(Arquillian.class)
      public class EnrichedClass {
      
         @Deployment(name = "cool_deployment")
         public static Archive deploy() {
            return ShrinkWrap.create(Archive.class);
         }
      
         @Drone
         @OperateOnDeployment("cool_deployment")
         WebDriver foo;
      
      }
  • Method scoped life cycle

    • Drone will be prepared in the Before phase and destroyed in the After phase, resulting in a fresh instance of drone for every test.

    • This scope is a default scope for the method parameter injection points. To declare a field injection point as a method-scoped Drone point use the annotation @MethodLifecycle:

      @RunWith(Arquillian.class)
      public class EnrichedClass {
      
         @Drone
         @MethodLifecycle
         WebDriver foo;
      
      }
  • Default scope

    • For injection point used as a field the Class scope is used as the default scope

    • For injection point used as a method parameter of some test method the Method scope is used as the default scope