开发者

Code coverage without instrumentation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_高级运维

Closed 4 years ago.

Improve this question

We have an automated regression test setup for Functional tests and are interested in measuring the test coverage/code coverage for our project which is based on Linux.

I would like to know if there are any tools which can be used for test coverage/code coverage measurement without instrumenting the code.

Please suggest any tool or method that can do this.

I am aware that instrumentation provides the best method to measure the code coverage, but it would suffice for us if the tool can just measure the functions that were executed for the test coverage measurement.

Thanks and Regards, Prashnk


There's only three ways to collect test coverage data:

  • Instrument the program, and let the instrumentation do to coverage collection
  • Interrupt the program (assuming native execution) on a periodic basic to determine its PC, and map the PC to source line numbers
  • Run the program under an interpreter, and let the interpreter do it (or let the interpreter make calls on an special user-code event handler when certain key program events occur, such as "function entry").

It may be in fact, that an interpreter doesn't have that ability built-in, in which case you are reduced to the first solution :-{ If you are running an interpreter, any test coverage data collection it may have built-in should be pretty well advertised in its documentation.

You can likely implement the "interrupt to get PC" method yourself, using symbol data from the link map or the object file (or maybe someone has done it already for you.) It has a serious downside: because you are sampling the PC, it is hard to verify that some function actually got executed. It may have, and you simply didn't sample the PC at the right moment. This is the reason this scheme isn't used in practical test coverage tools.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜