private void dump(Description description) { final String methodName = description.getMethodName(); System.out.println("***************************************************"); System.out.println(" - isSuite: " + description.isSuite()); System.out.println(" - isTest: " + description.isTest()); System.out.println(" - annotations: " + description.getAnnotations()); System.out.println(" - TestClass: " + description.getTestClass()); System.out.println(" - class name: " + description.getClassName()); System.out.println(" - method name: " + description.getMethodName()); System.out.println("###################################################"); }
@Override public Statement apply(final Statement base, final Description description) { if (description.isSuite()) { browserWasStarted = true; // TODO check if all methods of the class are annotated with JSOnly and skip driver creation // when it wont have JS ON return new RunTestMethodsInChosenDrivers(driverToRunTestsIn, base, url(description)); /*return new Statement() { @Override public void evaluate() throws Throwable { beforeClass(); base.evaluate(); afterClass(); } };*/ } Statement runTestMethodStatement = new Statement() { @Override public void evaluate() throws Throwable { boolean isJavaScriptOnlyTest = description.getAnnotation(JavaScriptOnly.class) != null; if (isJavaScriptOnlyTest && !isJavaScriptOn()) { System.out.println("\t\t-> Skipping JavaScript-only test: " + description); return; } beforeMethod(description); base.evaluate(); afterMethod(description); } }; if (!browserWasStarted) { // the test class has this as @Rule only and not as @ClassRule/@Rule, // so we restart the browser every method return new RunTestMethodsInChosenDrivers( driverToRunTestsIn, runTestMethodStatement, url(description)); } return runTestMethodStatement; }