我在某个特定环境中遇到此错误,但没有其他PC:
com.xxxx.site.functional.RegistrationFunctionalTest.testRegistrationLoginPopUpAvailable(com.xxxx.site.functional.RegistrationFunctionalTest)
Run 1: RegistrationFunctionalTest.testRegistrationLoginPopUpAvailable:19->Locomotive.setText:277->Locomotive.setText:281->Locomotive.waitForElement:246 » NullPointer
Run 2: RegistrationFunctionalTest>Locomotive.teardown:238 » NullPointer
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (default) @ xxxx-frontend ---
[INFO] Failsafe report directory: C:\Users\IEUser\git\xxx_web\target\failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:29.935s
[INFO] Finished at: Mon Sep 21 20:34:25 COT 2015
[INFO] Final Memory: 73M/185M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18:verify (default) on project xxxxx-frontend: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\IEUser\git\xxxxx\target\failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
ERROR: IllegalAccessException for stop method in class org.apache.tomcat.maven.plugin.tomcat7.run.ExtendedTomcat
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tomcat.maven.common.run.EmbeddedRegistry.shutdownAll(EmbeddedRegistry.java:110)
at org.apache.tomcat.maven.common.run.EmbeddedRegistry$1.run(EmbeddedRegistry.java:69)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:351)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:753)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:502)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 9 more
Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/core/ContainerBase$StopChild
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:1173)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.core.ContainerBase$StopChild
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 13 more
基本上发生的事情是,这是使用嵌入式Apache运行的功能测试用例。代码基本上分布在整个团队中。对于一些人来说,它可以工作,但对于一个特定的开发人员,他无法运行mvn功能测试用例。
答案 0 :(得分:0)
我不时遇到这样的问题。您必须小心测试套件中的全局状态。如果它适用于某些开发人员而某些开发人员不适用,则意味着测试排序很重要,因此某些测试会污染全局状态并影响其他测试。
尝试重现导致失败的测试顺序(例如尝试以这种方式明确获取失败的测试套件和订单测试的日志),在您的机器上模拟它并缩小相互影响的测试范围。这样你就可以找到它是什么样的讨厌的全局状态并修复它。
其他方法是在测试套件失败的区域内寻找全局状态(例如静态变量,单例弹簧中的非注入变量,......),并简单地删除全局状态,因为这是不好的做法。