Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下,1.46 生成coverage失败,能否帮忙看下 #19

Open
xiaoyao-jimmy opened this issue Jun 25, 2019 · 2 comments
Open

请问下,1.46 生成coverage失败,能否帮忙看下 #19

xiaoyao-jimmy opened this issue Jun 25, 2019 · 2 comments

Comments

@xiaoyao-jimmy
Copy link

使用的1.46版本 maven配置和报错文件,看问题是没有loaded的类,不知道怎么解决

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <argLine>-javaagent:"${settings.localRepository}"/org/jmockit/jmockit/1.46/jmockit-1.46.jar=coverage</argLine>
                    <systemPropertyVariables>
                        <coverage-output>html</coverage-output>
                        <coverage-metrics>all</coverage-metrics>
                        <coverage-classes>loaded</coverage-classes>
                    </systemPropertyVariables>
                    <!--<disableXmlReport>true</disableXmlReport>-->
                    <!--<argLine>-Dcoverage-metrics=all</argLine>-->
                </configuration>
            </plugin>
java.lang.NullPointerException
	at mockit.coverage.modification.ClassModification.redefineClassesAlreadyLoadedForCoverage(ClassModification.java:35)
	at mockit.coverage.modification.ClassModification.<init>(ClassModification.java:27)
	at mockit.coverage.CodeCoverage.<init>(CodeCoverage.java:37)
	at mockit.coverage.CodeCoverage.create(CodeCoverage.java:71)
	at mockit.internal.startup.Startup.activateCodeCoverageIfRequested(Startup.java:68)
	at mockit.internal.startup.Startup.premain(Startup.java:41)
	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:498)
	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
@hzdavid
Copy link
Owner

hzdavid commented Jul 2, 2019

@xiaoyao-jimmy 一定要用1.46吗?

jmockit的作者更新jmockit速度太快,差不多1-2个月就一个新版本, 向下兼容性也差。一些api说没有了就没有了。

JMockit中文网(jmockit.cn)上的大多数例子是基于1.36这个版本的,如果1.36能满足你的需求,就先用1.36吧,JMockit中文网(jmockit.cn)上关于用JMockit做覆盖率的例子:见 http://www.jmockit.cn/showArticle.htm?channel=3&id=30

(by the way,我最近工作有点忙,还没有去看1.46的jmockit,作者改了些啥。待有空了,再研究一下1.46。)

@aayii2015
Copy link

@hzdavid
136版本 没报错 也没生成覆盖率结果文件

maven-surefire-plugin
2.20

-javaagent:"${settings.localRepository}/org/jmockit/jmockit/1.36/jmockit-1.36.jar=coverage"
true
-Dcoverage-metrics=all

html
D:/tmp/codecoverage-output
all


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants