在Maven中运行测试时出现Geb异常
当我使用Maven从命令行运行测试时,出现此异常. 我的命令:
I get this exception when I run my tests from command line with maven. My command:
mvn -Dtest=specs.full.* -Dtestsystem=Win7/IE test
在我的本地计算机上,一切正常.但是,当我在安装了jenkins的服务器上运行测试时,出现以下异常:
On my local machine, everything works fine. But when I run the tests on our server, where jenkins is installed, I get following exception:
java.lang.VerifyError: (class: specs/full/ReadCheckMenuLinks, method: super$8$$spock_feature_3_1 signature: ()V) Illegal use of nonvirtual function call
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:57)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:64)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:59)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:54)
at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52)
at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:97)
at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:222)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
奇怪的是,这些测试可以在服务器上运行,但是现在我在运行的每个测试上都遇到了这个异常.
The strange thing is, that the tests worked on the server, but now I get this exception on every test I run.
这里可能是什么问题?
它很可能会取决于您在CI服务器上使用的jvm版本.在特定版本的Java 8中使用Groovy时,我已经看到类似的错误.请查看您的本地jvm版本,并确保Jenkins使用的本地版本相同.
It will most probably be down to the jvm version you're using on your CI server. I've seen similar errors when using Groovy with particular builds of Java 8. Have a look at what your local version of jvm is and ensure that the one used by Jenkins is the same.