Package org.jboss.arquillian.test.spi

Examples of org.jboss.arquillian.test.spi.TestRunnerAdaptor


    * ARQ-391, After not called when Error's are thrown, e.g. AssertionError
    */
   @Test
   public void shouldCallAllWhenTestThrowsException() throws Exception
   {
      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);
      executeAllLifeCycles(adaptor);

      throwException(Cycle.TEST, new Throwable());

      Result result = run(adaptor, ArquillianClass1.class);
View Full Code Here


      verify(adaptor, times(1)).afterSuite();
   }

   @Test
   public void shouldWorkWithTimeout() throws Exception {
      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);

      executeAllLifeCycles(adaptor);

      Result result = run(adaptor, ArquillianClass1WithTimeout.class);
View Full Code Here

      verify(adaptor, times(1)).afterSuite();
   }

   @Test
   public void shouldWorkWithAssume() throws Exception {
      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);

      executeAllLifeCycles(adaptor);
      final List<Failure> assumptionFailure = new ArrayList<Failure>();
      Result result = run(adaptor, new RunListener() {
          @Override
View Full Code Here

            // no, initialization has been attempted before, refuse to do anything else
            if(lastCreatedRunner.get() != null
            {
                throw new RuntimeException("Arquillian has previously been attempted initialized, but failed. See previous exceptions for cause.");
            }
            TestRunnerAdaptor adaptor = externalAdaptor;
            if(adaptor == null)
            {
               adaptor = TestRunnerAdaptorBuilder.build();
            }

            try
            {
               // don't set it if beforeSuite fails
               adaptor.beforeSuite();
               deployableTest.set(adaptor);
            }
            catch (Exception e)
            {
               throw new InitializationError(Arrays.asList((Throwable)e));
View Full Code Here

   @BeforeSuite(groups = "arquillian", inheritGroups = true)
   public void arquillianBeforeSuite() throws Exception
   {
      if(deployableTest.get() == null)
      {
         TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
         adaptor.beforeSuite();
         deployableTest.set(adaptor); // don't set TestRunnerAdaptor if beforeSuite fails
         cycleStack.get().push(Cycle.BEFORE_SUITE);
      }
   }
View Full Code Here

                              "Arquillian has previously been attempted initialized, but failed. See cause for previous exception",
                              State.getInitializationException())));
         }
         else
         {
            TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
            try
            {
               // don't set it if beforeSuite fails
               adaptor.beforeSuite();
               State.testAdaptor(adaptor);
            }
            catch (Exception e
            {
               // caught exception during BeforeSuite, mark this as failed
               State.caughtInitializationException(e);
               notifier.fireTestFailure(new Failure(getDescription(), e));
            }
         }
      }
      notifier.addListener(new RunListener()
      {
         @Override
         public void testRunFinished(Result result) throws Exception
         {
            State.runnerFinished();
            shutdown();
         }

         private void shutdown()
         {
            try
            {
               if(State.isLastRunner())
               {
                  try
                  {
                     if(State.hasTestAdaptor())
                     {
                        TestRunnerAdaptor adaptor = State.getTestAdaptor();
                        adaptor.afterSuite();
                        adaptor.shutdown();
                     }
                  }
                  finally
                  {
                     State.clean();
View Full Code Here

   private void initalizeTestAdaptor()
   {
      if (deployableTest == null)
      {
         final TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
         try
         {
            log.fine("beforeSuite");
            // don't set it if beforeSuite fails
            adaptor.beforeSuite();
            deployableTest = adaptor;
         }
         catch (Exception e)
         {
            throw new SpockExecutionException("Unable to hook Arquillian Spock test adaptor", e);
View Full Code Here

                              "Arquillian has previously been attempted initialized, but failed. See cause for previous exception",
                              State.getInitializationException())));
         }
         else
         {
            TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
            try
            {
               // don't set it if beforeSuite fails
               adaptor.beforeSuite();
               State.testAdaptor(adaptor);
            }
            catch (Exception e
            {
               // caught exception during BeforeSuite, mark this as failed
               State.caughtInitializationException(e);
               notifier.fireTestFailure(new Failure(getDescription(), e));
            }
         }
      }
      notifier.addListener(new RunListener()
      {
         @Override
         public void testRunFinished(Result result) throws Exception
         {
            State.runnerFinished();
            shutdown();
         }

         private void shutdown()
         {
            try
            {
               if(State.isLastRunner())
               {
                  try
                  {
                     if(State.hasTestAdaptor())
                     {
                        TestRunnerAdaptor adaptor = State.getTestAdaptor();
                        adaptor.afterSuite();
                        adaptor.shutdown();
                     }
                  }
                  finally
                  {
                     State.clean();
View Full Code Here

   @BeforeSuite(groups = "arquillian", inheritGroups = true)
   public void arquillianBeforeSuite() throws Exception
   {
      if(deployableTest.get() == null)
      {
         TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
         adaptor.beforeSuite();
         deployableTest.set(adaptor); // don't set TestRunnerAdaptor if beforeSuite fails
         cycleStack.get().push(Cycle.BEFORE_SUITE);
      }
   }
View Full Code Here

                              "Arquillian has previously been attempted initialized, but failed. See cause for previous exception",
                              State.getInitializationException())));
         }
         else
         {
            TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
            try
            {
               // don't set it if beforeSuite fails
               adaptor.beforeSuite();
               State.testAdaptor(adaptor);
            }
            catch (Exception e
            {
               // caught exception during BeforeSuite, mark this as failed
               State.caughtInitializationException(e);
               notifier.fireTestFailure(new Failure(getDescription(), e));
            }
         }
      }
      notifier.addListener(new RunListener()
      {
         @Override
         public void testRunFinished(Result result) throws Exception
         {
            State.runnerFinished();
            shutdown();
         }

         private void shutdown()
         {
            try
            {
               if(State.isLastRunner())
               {
                  try
                  {
                     if(adaptor != null)
                     {
                        adaptor.afterSuite();
                        adaptor.shutdown();
                     }
                  }
                  finally
                  {
                     State.clean();
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.test.spi.TestRunnerAdaptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.