Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to discover which test unit checks which lines of code?

I was fooling around the NUint, hoping to discover a way to realize which line of code passes in which test.

Imagine I have a method for which I have 3 tests. Is there any way to find out which test checks which line of code?

Having used NCover, I know you can find out which lines have been tested and which have not. However, you really can't see which unit checked that code.

It can be really useful when dealing with tons of tests...

like image 412
Javid_p84 Avatar asked Jun 21 '11 06:06

Javid_p84


People also ask

Which test only code is checked?

Also known as closed-box testing, data-driven testing, or functional testing. Also known as translucent testing, as the tester has limited knowledge of the insides of the application. Also known as clear-box testing, structural testing, or code-based testing. Performed by end-users and also by testers and developers.

What unit tests check?

In computer programming, unit testing is a software testing method by which individual units of source code—sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures—are tested to determine whether they are fit for use.

Is unit testing performed prior to code check in?

Unit Testing is done during the development (coding phase) of an application by the developers. Unit Tests isolate a section of code and verify its correctness. A unit may be an individual function, method, procedure, module, or object.


1 Answers

JetBrains dotCover can help you to get the info you are looking for. It integrates with the ReSharper unit test runner and collects per-test data. You can see which code is covered by the each particular test (with corresponding highlighting in VS). And what is more interesting, for every piece of code you can get list of tests which cover it and easily rerun them.

Additional info is available here: http://blogs.jetbrains.com/dotnet/2010/07/show-covering-test-with-dotcover/

like image 133
Ruslan Isakiev Avatar answered Oct 11 '22 08:10

Ruslan Isakiev