diff --git a/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java b/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java index 19728049a..293edca05 100644 --- a/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java +++ b/tools/junit/src/main/java/org/teavm/junit/HtmlUnitRunStrategy.java @@ -59,7 +59,7 @@ class HtmlUnitRunStrategy implements TestRunStrategy { throw new RuntimeException(e); } page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "runtime.js"))); - page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "test.js"))); + page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), run.getFileName()))); AsyncResult asyncResult = new AsyncResult(); Function function = (Function) page.get().executeJavaScript(readResource("teavm-htmlunit-adapter.js")) diff --git a/tools/junit/src/main/java/org/teavm/junit/SeleniumRunStrategy.java b/tools/junit/src/main/java/org/teavm/junit/SeleniumRunStrategy.java index 62db69ea6..b460a1f73 100644 --- a/tools/junit/src/main/java/org/teavm/junit/SeleniumRunStrategy.java +++ b/tools/junit/src/main/java/org/teavm/junit/SeleniumRunStrategy.java @@ -32,7 +32,6 @@ class SeleniumRunStrategy implements TestRunStrategy { private URL url; private ThreadLocal webDriver = new ThreadLocal<>(); private ThreadLocal commandsSent = new ThreadLocal<>(); - private int rebootRate = Integer.getInteger("teavm.junit.js.selenium.rebootAfter", 1000); public SeleniumRunStrategy(URL url) { this.url = url; @@ -68,7 +67,7 @@ class SeleniumRunStrategy implements TestRunStrategy { return (String) js.executeAsyncScript( readResource("teavm-selenium.js"), readFile(new File(run.getBaseDirectory(), "runtime.js")), - readFile(new File(run.getBaseDirectory(), "test.js")), + readFile(new File(run.getBaseDirectory(), run.getFileName())), readResource("teavm-selenium-adapter.js")); } catch (Throwable e) { run.getCallback().error(e); diff --git a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java index 906cd1a11..5f6e80442 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java +++ b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java @@ -332,7 +332,7 @@ public class TeaVMTestRunner extends Runner implements Filterable { return new TestRun(compileResult.file.getParentFile(), child, new MethodReference(testClass.getName(), getDescriptor(child)), - description, callback); + description, compileResult.file.getName(), callback); } private void submitRun(TestRun run) { @@ -402,6 +402,11 @@ public class TeaVMTestRunner extends Runner implements Filterable { .setClassLoader(classLoader) .setClassSource(classSource) .build(); + + Properties properties = new Properties(); + applyProperties(method.getDeclaringClass(), properties); + vm.setProperties(properties); + vm.setIncremental(false); configuration.apply(vm); vm.installPlugins(); @@ -409,10 +414,6 @@ public class TeaVMTestRunner extends Runner implements Filterable { new TestExceptionPlugin().install(vm); new TestEntryPointTransformer(runnerType.getName(), methodHolder.getReference()).install(vm); - Properties properties = new Properties(); - applyProperties(method.getDeclaringClass(), properties); - vm.setProperties(properties); - MethodReference exceptionMsg = new MethodReference(ExceptionHelper.class, "showException", Throwable.class, String.class); vm.entryPoint("runTest", new MethodReference(TestEntryPoint.class, "run", void.class)).async(); diff --git a/tools/junit/src/main/java/org/teavm/junit/TestRun.java b/tools/junit/src/main/java/org/teavm/junit/TestRun.java index 2487f2636..0e6526a00 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TestRun.java +++ b/tools/junit/src/main/java/org/teavm/junit/TestRun.java @@ -26,14 +26,16 @@ class TestRun { private MethodReference reference; private Description description; private TestRunCallback callback; + private String fileName; - TestRun(File baseDirectory, Method method, MethodReference reference, Description description, + TestRun(File baseDirectory, Method method, MethodReference reference, Description description, String fileName, TestRunCallback callback) { this.baseDirectory = baseDirectory; this.method = method; this.reference = reference; this.description = description; this.callback = callback; + this.fileName = fileName; } public File getBaseDirectory() { @@ -55,4 +57,8 @@ class TestRun { public TestRunCallback getCallback() { return callback; } + + public String getFileName() { + return fileName; + } }