Make resources directory relative
7ep opened this issue · 2 comments
The location of selenified.properties is currently hardcoded to src/test/resources/selenified.properties
Why not make it a relative directory? Like this:
InputStream input = Property.class.getClassLoader().getResourceAsStream(SELENIFIED)
Where SELENIFIED becomes:
private static final String SELENIFIED = "selenified.properties";
This will allow me to have the properties file in a resources directory relative to the correct set of tests when I divide them up into different directories. See https://github.com/7ep/demo/blob/master/src/README.txt
Just tried testing this.
The good news: it does find the selenified.properties file in the place I hoped it would
the bad news: tests not working any more:
java.lang.IllegalStateException: java.lang.NoSuchFieldException: modifiers
at com.coveros.selenified.services.HTTP.allowMethods(HTTP.java:376)
at com.coveros.selenified.services.HTTP.<init>(HTTP.java:110)
at com.coveros.selenified.Selenified.startTest(Selenified.java:427)
at com.coveros.selenified.Selenified.startTest(Selenified.java:350)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: java.lang.NoSuchFieldException: modifiers
at java.base/java.lang.Class.getDeclaredField(Class.java:2417)
at com.coveros.selenified.services.HTTP.allowMethods(HTTP.java:363)
... 30 more
Per conversation between Max and Byron, determined that this works on JDK 8, not on OpenJDK12 like Byron was using. It's a reflection issue, that's changed.