被测试的class是VINESNodeAddressCollector:
@RunWith(PowerMockRunner.class)
//add following VINESNodeAddressCollector.class will make coverage not work, so comment out.
@PrepareForTest({ApplicationRunner.class
/*, VINESNodeAddressCollector.class*/})
@PowerMockIgnore ({"org.apache.log4j.*", "org.apache.commons.logging.*", "org.xml.sax.*"})
网上搜到的答案:http://stackoverflow.com/questions/9726212/why-tclemma-doesnt-coverage-code-with-tests-with-runwithpowermockrunner-class
AFAIK eclEmma, as well as many other coverage systems, modify your .class files to add coverage instructions. Most of these tools do that at "compile time", not at run time.
PowerMock instead, as well as AspectJ LTW and many other systems, manipulate the same bytecode but at "run time":
PowerMock is a framework that extend other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more.
I have a similar problem with both eclEmma (various versions) and Cobertura in combination with AspectJ LTW, cause when the runtime modification of .class files happen, it somehow corrupts the modification done previously by the coverage tool.
I don't have yet found a solution, but at least found the symptom.
The right solution would be to debug PowerMock instrumentation and find out where and how it breaks coverage tools. It's quite a problem, for a testing tool, to break coverage tools, since the two are quite often used together
分享到:
相关推荐
Learn how to write R code with fewer bugs. The problem with programming is that you are always one typo away from writing something silly. Likewise with data analysis, a small mistake in your model ...
开源项目-quii-learn-go-with-tests.zip,Learn Go by writing tests - Hello, world
org.junit.runners.AllTests.class org.junit.runners.BlockJUnit4ClassRunner.class org.junit.runners.JUnit4.class org.junit.runners.Parameterized.class org.junit.runners.ParentRunner.class org.junit....
Master high quality software development driven by unit tests About This Book Design and implement robust system components by means of the de facto unit testing standard in Java Reduce defect rate ...
As a tester, you'll automate your tests. As a developer, you'll build more robust solutions. And as a team, you'll gain a vocabulary and a means to coordinate how to write and organize automated ...
测试在文件coverage-tests.js中指定。 每种语言都有一个文件夹,其中应包含该语言的发射器,模板和替代。 示例: : 在特定的SDK存储库中,应该有一个具有package.json的coverage-tests文件夹,该文件夹具有@...
1. boson.sniffer.practice.tests.v5.34 CCNA资源;
How.Google.Tests.Software.Mar.2012.rar
Kotlin多平台库提供显式类型(Kotlin multiplatform library providing explicit types.,) 说明:Kotlin多平台库提供显式类型。, (Kotlin multiplatform library providing explicit types.,) ....run/JVM tests.run
.run/All tests.run.xml (941, 2023-12-19) .run/Check API binaries.run.xml (950, 2023-12-19) .run/Documentation.run.xml (958, 2023-12-19) .run/Dump API binaries.run.xml (948, 2023-12-19) .run/JS tests....
PesterState.Tests.ps1
How.Google.Tests.Software
CompTIA.Securityplus.Practice.Tests.SY0-501
org.maven.ide.eclipse.integration.tests.common_0.12.1.20110112-1712.jar
salesforce apex workbook
Featuring graphs and highlighted code examples throughout, the book features tests with Python’s Numpy, Pandas, Scikit-Learn, and SciPy data science libraries. If you’re a software engineer or ...
How to work with code coverage, fixtures data, and private methods Who this book is for This book is for experienced ...
4.8.1 Prepare Test Cases with Good Code Coverage . . . . 42 4.8.2 Provide Additional Computer Resources . . . . . . 42 4.8.3 Multi-Threading May Not be Supported . . . . . . 42 4.8.4 Support for Non-...