/** * Override to allow test methods with arguments */ @Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
@Override protected Description describeChild(final FrameworkMethod method) { if (!Boolean.getBoolean("cukespace.runner.standard-describe") && InstanceControlledFrameworkMethod.class.isInstance(method)) { return Description.createTestDescription( InstanceControlledFrameworkMethod.class.cast(method).getOriginalClass(), ArquillianCucumber.RUN_CUCUMBER_MTD, method.getAnnotations()); } return super.describeChild(method); }
protected Description getFailureDescription() { return getDescription(); } };
withRules.setAccessible(true); Statement statement = methodInvoker(method, test); statement = possiblyExpectingExceptions(method, test, statement); statement = withPotentialTimeout(method, test, statement); Statement arounds = withBefores(method, test, statement); arounds = withAfters(method, test, arounds); final Statement stmtWithLifecycle = arounds; new RulesEnrichment(test, getTestClass(), method.getMethod(), LifecycleMethodExecutor.NO_OP));
@Override public void run(RunNotifier notifier) { Class<?> testClass = getTestClass().getJavaClass(); final ClassLoader parent = Thread.currentThread().getContextClassLoader(); synchronized (ArquillianChameleon.class) { if (isInClientSide(parent) && !isSpecialChameleonFile(parent)) { try { Path arquillianChameleonConfiguration = new ArquillianChameleonConfigurator().setup(testClass, parent); log.info(String.format("Arquillian Configuration created by Chameleon runner is placed at %s.", arquillianChameleonConfiguration.toFile().getAbsolutePath())); createChameleonMarkerFile(arquillianChameleonConfiguration.getParent()); addsArquillianFile(arquillianChameleonConfiguration.getParent(), parent); } catch (Exception e) { throw new IllegalArgumentException(e); } } } super.run(notifier); }
@Override protected void runChild(final FrameworkMethod method, final RunNotifier notifier) { if (InstanceControlledFrameworkMethod.class.isInstance(method)) { InstanceControlledFrameworkMethod.class.cast(method).setNotifier(notifier); } super.runChild(method, notifier); }
List<TestRule> rules = new ArrayList<TestRule>(super.getTestRules(target)); rules.add(new TestRule() {
@Override protected List<FrameworkMethod> computeTestMethods() { if (methods != null) { return methods; } methods = new LinkedList<FrameworkMethod>(); // run @Test methods for (final FrameworkMethod each : ArquillianCucumber.super.computeTestMethods()) { methods.add(each); } try { // run cucumber, this looks like a hack but that's to keep @Before/@After/... hooks behavior final Method runCucumber = BaseCukeSpace.class.getDeclaredMethod(RUN_CUCUMBER_MTD, Object.class, Object.class); methods.add(new InstanceControlledFrameworkMethod(this, getTestClass().getJavaClass(), runCucumber)); } catch (final NoSuchMethodException e) { // no-op: will not accur...if so this exception is not your biggest issue } return methods; }
withRules.setAccessible(true); Statement statement = methodInvoker(method, test); statement = possiblyExpectingExceptions(method, test, statement); statement = withPotentialTimeout(method, test, statement); Statement arounds = withBefores(method, test, statement); arounds = withAfters(method, test, arounds); final Statement stmtWithLifecycle = arounds; new RulesEnrichment(test, getTestClass(), method.getMethod(), LifecycleMethodExecutor.NO_OP));
@Override public void run(RunNotifier notifier) { Class testClass = getTestClass().getJavaClass(); try { checkRequirements(testClass); super.run(notifier); } catch (UnsatisfiedRequirementException e) { log.log(Level.WARNING, String.format("Unsatisfied assumption in test class %s. Requirement problem: %s.", testClass.getName(), e.getMessage())); notifier.fireTestAssumptionFailed(new Failure(getDescription(), e)); } }
/** * Override to allow test methods with arguments */ @Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
protected Description getFailureDescription() { return getDescription(); } };
/** * Override to allow test methods with arguments */ @Override protected void validatePublicVoidNoArgMethods(Class<? extends Annotation> annotation, boolean isStatic, List<Throwable> errors) { List<FrameworkMethod> methods = getTestClass().getAnnotatedMethods(annotation); for (FrameworkMethod eachTestMethod : methods) { eachTestMethod.validatePublicVoid(isStatic, errors); } }
@Override public void evaluate() throws Throwable { deployableTest.get().beforeClass( Arquillian.this.getTestClass().getJavaClass(), new StatementLifecycleExecutor(onlyBefores)); originalStatement.evaluate(); } };
@Override public void evaluate() throws Throwable { adaptor.beforeClass( Arquillian.this.getTestClass().getJavaClass(), new StatementLifecycleExecutor(onlyBefores)); originalStatement.evaluate(); } };
@Override public void evaluate() throws Throwable { adaptor.beforeClass( Arquillian.this.getTestClass().getJavaClass(), new StatementLifecycleExecutor(onlyBefores)); originalStatement.evaluate(); } };
@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); } }
new BeforeRules(test, getTestClass(), stmtWithRules, method.getMethod(), new LifecycleMethodExecutor() { @Override
new BeforeRules(test, getTestClass(), stmtWithRules, method.getMethod(), new LifecycleMethodExecutor() { @Override