EvoSuite / evosuite

EvoSuite - automated generation of JUnit test suites for Java classes
http://www.evosuite.org
GNU Lesser General Public License v3.0
829 stars 340 forks source link

java.lang.NullPointerException: null when generating tests #406

Open shuqing1 opened 2 years ago

shuqing1 commented 2 years ago

Hello, This is my third problem with EvoSuite, and I would like your guidance to solve them. Looking forward to your reply. Thank you!

I compiled the project, and I'm sure this class is at target\classes.

D:\a\za-newbee-bill>java -jar evosuite-master-1.2.1-SNAPSHOT.jar -class XXXX -target target/classes

EvoSuite 1.2.1-SNAPSHOT Going to generate test cases for class: XXXX Starting Client-0 Properties loaded from D:\a\za-newbee-bill\evosuite-files\evosuite.properties Connecting to master process on port 2091 Analyzing classpath: D:/maven/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar target/classes D:/maven/repository/com/alibaba/fastjson/1.2.62/fastjson-1.2.62.jar D:/maven/repository/org/apache/poi/poi-ooxml/3.8/poi-ooxml-3.8.jar Error while initializing target class: java.lang.NullPointerException [MASTER] 16:39:50.159 [logback-2] ERROR TestSuiteGenerator - Problem for XXXX . Full stack: java.lang.NullPointerException: null at org.evosuite.setup.PutStaticMethodCollector.collectMethods(PutStaticMethodCollector.java:132) at org.evosuite.setup.TestClusterGenerator.initializeTargetMethods(TestClusterGenerator.java:648) at org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:119) at org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:120) at org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:136) at org.evosuite.TestSuiteGenerator.initializeTargetClass(TestSuiteGenerator.java:114) at org.evosuite.TestSuiteGenerator.generateTestSuite(TestSuiteGenerator.java:135) at org.evosuite.rmi.service.ClientNodeImpl.lambda$startNewSearch$0(ClientNodeImpl.java:140) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Computation finished [MASTER] 16:39:52.824 [main] ERROR SearchStatistics - No statistics has been saved because EvoSuite failed to generate any test case [MASTER] 16:39:52.932 [main] ERROR TestGeneration - failed to write statistics data