public ArquillianTest() { if (State.hasTestAdaptor()) { adaptor = State.getTestAdaptor(); } else { throw new IllegalStateException("arquillian not initialized. Please make sure to define `ArquillianTestClass` Rule in" + " your testclass. This could be one of the reason for arquillian not to be initialized."); } }
public ArquillianTest() { if (State.hasTestAdaptor()) { adaptor = State.getTestAdaptor(); } else { throw new IllegalStateException("arquillian not initialized. Please make sure to define `ArquillianTestClass` Rule in" + " your testclass. This could be one of the reason for arquillian not to be initialized."); } }
void beforeTestClassPhase(Class<?> testClass) throws Exception { State.runnerStarted(); initializeAdaptor(); // initialization ok, run children if (State.hasTestAdaptor()) { setAdaptor(State.getTestAdaptor()); } getAdaptor().beforeClass(testClass, LifecycleMethodExecutor.NO_OP); }
void beforeTestClassPhase(Class<?> testClass) throws Exception { State.runnerStarted(); initializeAdaptor(); // initialization ok, run children if (State.hasTestAdaptor()) { setAdaptor(State.getTestAdaptor()); } getAdaptor().beforeClass(testClass, LifecycleMethodExecutor.NO_OP); }
void initializeAdaptor() throws Exception { // first time we're being initialized if (!State.hasTestAdaptor()) { // no, initialization has been attempted before and failed, refuse // to do anything else if (State.hasInitializationException()) { // failed on suite level, ignore children // notifier.fireTestIgnored(getFailureDescription()); handleSuiteLevelFailure(State.getInitializationException()); } else { try { // ARQ-1742 If exceptions happen during boot TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder .build(); // 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); handleBeforeSuiteFailure(e); } } } if (State.hasTestAdaptor()) { setAdaptor(State.getTestAdaptor()); } }
void initializeAdaptor() throws Exception { // first time we're being initialized if (!State.hasTestAdaptor()) { // no, initialization has been attempted before and failed, refuse // to do anything else if (State.hasInitializationException()) { // failed on suite level, ignore children // notifier.fireTestIgnored(getFailureDescription()); handleSuiteLevelFailure(State.getInitializationException()); } else { try { // ARQ-1742 If exceptions happen during boot TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder .build(); // 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); handleBeforeSuiteFailure(e); } } } if (State.hasTestAdaptor()) { setAdaptor(State.getTestAdaptor()); } }
@Override public void run(final RunNotifier notifier) { if (State.hasAnyArquillianRule(this.getTestClass())) { throw new RuntimeException(String.format("TestClass: %s contains Arquillian runner and Arquillian Rule." + " Arquillian doesn't support @RunWith(Arquillian.class) and ArquillianTestClass or " + "ArquillianTest to use at the same time. You have to decide whether you want use runner:" + " http://arquillian.org/arquillian-core/#how-it-works or rules : http://arquillian.org/arquillian-core/#_how_to_use_it", this.getTestClass().getName())); } if (State.isNotRunningInEclipse()) { State.runnerStarted(); } AdaptorManagerWithNotifier adaptorManager = new AdaptorManagerWithNotifier(notifier) { protected void setAdaptor(TestRunnerAdaptor testRunnerAdaptor) { adaptor = testRunnerAdaptor; } protected TestRunnerAdaptor getAdaptor() { return adaptor; } protected Description getFailureDescription() { return getDescription(); } }; adaptorManager.initializeAdaptor(); adaptorManager.prepareDestroyAdaptorProcess(); // initialization ok, run children if (State.hasTestAdaptor()) { super.run(notifier); } }
@Override public void run(final RunNotifier notifier) { if (State.hasAnyArquillianRule(this.getTestClass())) { throw new RuntimeException(String.format("TestClass: %s contains Arquillian runner and Arquillian Rule." + " Arquillian doesn't support @RunWith(Arquillian.class) and ArquillianTestClass or " + "ArquillianTest to use at the same time. You have to decide whether you want use runner:" + " http://arquillian.org/arquillian-core/#how-it-works or rules : http://arquillian.org/arquillian-core/#_how_to_use_it", this.getTestClass().getName())); } if (State.isNotRunningInEclipse()) { State.runnerStarted(); } AdaptorManagerWithNotifier adaptorManager = new AdaptorManagerWithNotifier(notifier) { protected void setAdaptor(TestRunnerAdaptor testRunnerAdaptor) { adaptor = testRunnerAdaptor; } protected TestRunnerAdaptor getAdaptor() { return adaptor; } protected Description getFailureDescription() { return getDescription(); } }; adaptorManager.initializeAdaptor(); adaptorManager.prepareDestroyAdaptorProcess(); // initialization ok, run children if (State.hasTestAdaptor()) { super.run(notifier); } }