当我使用 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)]
最后,没有生成用例。