Open narenthanguturi opened 2 years ago
错误信息:Caused by: java.lang.IllegalArgumentException: null
查看原码:InheritanceTreeGenerator.java -> method: analyzeClassStream() , no try catch IllegalArgumentException .
debug - > 错误加载类为项目依赖jar包 wildfly-common-1.5.2.Final.jar - META-INF.versions.xxxxx.JDKSpecific.class
通过 修改 源代码 -》 method: analyzeClassStream() 添加 catch , 重新打包。
I encountered the same problem, perhaps there were some undefined bugs in the source codes of Evosuite.
I solved the problems by these:
Create a total new maven project and use the following pom.xml
to build everything you need. Then run mvn evosuite:generate
. That will be Okay!
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>se_week5lab</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<evosuiteVersion>1.0.6</evosuiteVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.evosuite.plugins</groupId>
<artifactId>evosuite-maven-plugin</artifactId>
<version>1.0.6</version>
<executions><execution>
<goals> <goal> prepare </goal> </goals>
<phase> process-test-classes </phase>
</execution></executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>org.evosuite.runtime.InitializingListener</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.evosuite</groupId>
<artifactId>evosuite-standalone-runtime</artifactId>
<version>1.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Context
Please provide below a detailed introduction to the issue itself, and describe what you were doing when the issue happened. Or, what do you want to achieve? We are using Java 8, and below dependencies
EvoSuite Arguments
Please provide the whole EvoSuite commmand you executed (if relevant) -DmemoryInMB=2000 -Dcores=2 evosuite:generate evosuite:export
Current Result
Please describe here below the current result you got (if relevant) [if relevant, include a screenshot] [MASTER] 12:52:16.295 [pool-2-thread-1] ERROR TestSuiteGenerator - Problem for com.demo.ccpaid.util.CommonUtils. Full stack: java.lang.IllegalArgumentException: null at org.evosuite.shaded.org.objectweb.asm.ClassReader.(ClassReader.java:160)
at org.evosuite.shaded.org.objectweb.asm.ClassReader.(ClassReader.java:143)
at org.evosuite.shaded.org.objectweb.asm.ClassReader.(ClassReader.java:418)
at org.evosuite.setup.InheritanceTreeGenerator.analyzeClassStream(InheritanceTreeGenerator.java:238)
at org.evosuite.setup.InheritanceTreeGenerator.createFromClassPath(InheritanceTreeGenerator.java:101)
at org.evosuite.setup.DependencyAnalysis.initInheritanceTree(DependencyAnalysis.java:77)
at org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:131)
at org.evosuite.TestSuiteGenerator.initializeTargetClass(TestSuiteGenerator.java:110)
at org.evosuite.TestSuiteGenerator.generateTestSuite(TestSuiteGenerator.java:130)
at org.evosuite.rmi.service.ClientNodeImpl$1.run(ClientNodeImpl.java:145)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
In Eclipse console, we are seeing below statement WARN: failed to generate tests for 22 classes out of 22