0

当我使用 evosuite 为我的 android 项目生成测试用例时出现此错误。

刚开始出现这样的错误:“cannot find this class:android.support.v7.widget.Toolbar” 我通过在CP路径中加入Android的jar包:collections-28.0.0.jar解决了这个问题,然后多个文件自动生成用例的过程中出现如下错误:

[MASTER] 21:22:39.979 [logback-2]错误 TestClusterGenerator - com.rapidapp.base.account.AppBaseService 的问题。无法为类 android.support.v7.widget.Toolbar 添加依赖项:java.lang.NoClassDefFoundError:android/support/v7/widget/Toolbar$SavedState [java.lang.Class.getDeclaringClass0(Native Method), java.lang.Class.getDeclaringClass(Class.java:1235), java.lang.Class.getEnclosureClass(Class.java:1277), java.lang.Class.getSimpleBinaryName (Class.java:1443)、java.lang.Class.getSimpleName(Class.java:1309)、java.lang.Class.isAnonymousClass(Class.java:1411)、org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker. java:155), org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker.java:338), org.evosuite.setup.TestClusterGenerator.addDependencyClass(TestClusterGenerator.java:975), org.evosuite.setup.TestClusterGenerator.resolveDependencies(TestClusterGenerator .java:358)、org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:137)、org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:118)、org.evosuite.setup.DependencyAnalysis。analyzeClass(DependencyAnalysis.java:132)、org.evosuite.TestSuiteGenerator.initializeTargetClass(TestSuiteGenerator.java:110)、org.evosuite.TestSuiteGenerator.generateTestSuite(TestSuiteGenerator.java:130)、org.evosuite.rmi.service.ClientNodeImpl$1。运行(ClientNodeImpl.java:145)、java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)、java.util.concurrent.FutureTask.run(FutureTask.java:266)、java.util.concurrent .ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617), java.lang.Thread.run(Thread.java:745)]145), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.run(FutureTask.java:266), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor .java:1142), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617), java.lang.Thread.run(Thread.java:745)]145), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.run(FutureTask.java:266), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor .java:1142), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617), java.lang.Thread.run(Thread.java:745)]

最后,没有生成用例。

4

1 回答 1

0

我之前经历过这个异常,当(尝试)运行在另一个操作系统上编译的代码时。此外,当操作系统发生更新时。

尽管您可能认为向后兼容性应该稍后删除它,但情况并非总是如此!

于 2019-03-24T16:02:35.400 回答