Tagged Questions

77
votes
24answers
18k views

What is a reasonable code coverage % for unit tests (and why)?

If you were to mandate a minimum percentage code-coverage for unit tests, perhaps even as a requirement for committing to a repository, what would it be? Please explain how you arrived at your answer ...
63
votes
13answers
11k views

Can you recommend an alternative for NCover? [closed]

I'm looking for a good .Net code coverage alternative to NCover (insufficient .Net 3.5 coverage and now pay-for) or VSTS (way too expensive). We currently test with NUnit, but could switch to ...
63
votes
11answers
15k views

How can I unit test a GUI?

The calculations in my code are well-tested, but because there is so much GUI code, my overall code coverage is lower than I'd like. Are there any guidelines on unit-testing GUI code? Does it even ...
44
votes
5answers
7k views

Perl build, unit testing, code coverage: A complete working example

Most Stackoverflow answers that I have found in regards to the Perl build process and unit testing and code coverage simply point me to CPAN for the documentation there. There's absolutely nothing ...
24
votes
10answers
7k views

Free Testing / Code Coverage systems for C++ [closed]

I'd like to start using a Test Driven Development system for a private project since I saw my employer using it and realized it was very useful. My employer's project was in C# but mines are in C and ...
23
votes
13answers
2k views

Pitfalls of code coverage [closed]

I'm looking for real world examples of some bad side effects of code coverage. I noticed this happening at work recently because of a policy to achieve 100% code coverage. Code quality has been ...
23
votes
15answers
3k views

Should one test internal implementation, or only test public behaviour?

Given software where ... The system consists of a few subsystems Each subsystem consists of a few components Each component is implemented using many classes ... I like to write automated tests of ...
23
votes
5answers
4k views

Code Coverage Tools for Scala

What are the available code coverage tools for Scala? I have Scala spec tests and a Hudson continuous integration set-up. Is there something I can hook-in to this setup to measure and track code ...
22
votes
6answers
6k views

Code Coverage and Unit Testing of Python Code

I have already visited Preferred Python unit-testing framework. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come ...
21
votes
5answers
14k views

Getting PartCover to work

I want to try PartCover for code coverage. I'm running Visual Studio 2008 Professional with MSTest. The Professional Edition does not include the Team Testing tools, like Code Coverage. So, I'm ...
20
votes
14answers
7k views

What is your favourite code coverage tool(s)? (Free and non-free)

What is your favourite code coverage tool(s) (free/non-free) and how do you use them effectively? There are several options available, such as: CodeCover Coverlipse Emma / EclEmma Atlassian Clover ...
19
votes
5answers
2k views

Measuring code coverage in Delphi

Is there any way to measure code coverage with DUnit? Or are there any free tools accomplishing that? What do you use for that? What code coverage do you usually go for? Jim McKeeth: Thanks for the ...
19
votes
4answers
2k views

Is mutation testing useful in practice?

It exists the technology of mutation testing. It checks, if the tests are running even if you change the code. If not all is OK, if the tests are running they don't cover all eventualities. There is ...
16
votes
6answers
1k views

condition coverage in python

Is there any tool/library that calculate percent of "condition/decision coverage" of python code. I found only coverage.py but it calculates only percent of "statement coverage".
14
votes
3answers
4k views

XCode - Code Coverage?

I need code coverage for my iphone app. Can anyone provide detailed information on how to get code coverage for Xcode 4? Thanks
13
votes
13answers
2k views

Unit testing code coverage - do you have 100% coverage?

Do your unit tests constitute 100% code coverage? Yes or no, and why or why not.
12
votes
21answers
966 views

What type of errors could my code still contain even if I have 100% code coverage?

What type of errors could my code still contain even if I have 100% code coverage? I'm looking for concrete examples or links to concrete examples of such errors.
12
votes
3answers
349 views

Django Template Test Coverage

Is there any way to produce a report containing the code coverage in my django test suite for my site's templates? I already have coverage for python, but coverage for templates to identify dead or ...
10
votes
14answers
2k views

What can be alternative metrics to code coverage?

Code coverage is propably the most controversial code metric. Some say, you have to reach 80% code coverage, other say, it's superficial and does not say anything about your testing quality. (See Jon ...
10
votes
1answer
1k views

Ruby test coverage tool

I need a tool, which measures test coverage under Ruby. I tried rcov, but couldn't install it neither under Windows, nor under cygwin, nor under Ubuntu. Which programs (not necessarily free) ...
10
votes
4answers
2k views

How to ignore generated code from code coverage data

I am using Visual Studio 2010 and would like to exclude the generated service reference code from my code coverage statistics. I found an article pre 2010 that mentions using DebuggerNonUserCode and ...
10
votes
1answer
3k views

jasmine with jscoverage automated testing

Had been looking at the jsunit and jcoverage demos here (click on coverage report link. Open this in a new tab). I was wondering if any one had done anything similar with Jasmine and JSCoverage ? I'm ...
9
votes
3answers
1k views

How to decorate a class as untestable for Code Coverage?

Background: Visual Studio 2008, C#, .Net 3.5. I have a number of utility classes that are simply not unit-testable. This is mainly because they interact with resources (e.g. databases, files etc). ...
9
votes
5answers
6k views

How can I measure CppUnit test coverage (on win32 and Unix)?

I have a very large code base that contains extensive unit tests (using CppUnit). I need to work out what percentage of the code is exercised by these tests, and (ideally) generate some sort of report ...
9
votes
1answer
206 views

Weird test coverage results for iterator block, why are these statements not executed?

I'm using dotCover to analyze code coverage of my unit tests, and I'm getting some strange results... I have an iterator method for which the coverage is not complete, but the statements that are not ...
9
votes
3answers
301 views

Distributed unit testing and code coverage in Python

My current project has a policy of 100% code coverage from its unit tests. Our continuous integration service will not allow developers to push code without 100% coverage. As the project has grown, ...
9
votes
3answers
505 views

Ensure minimal coverage on new Subversion commits

We have a massive project with almost no unit tests at all. I would like to ensure from now on that the developers commit new features (or bugs!) without minimal coverage for corresponding unit tests. ...
9
votes
5answers
3k views

Why does Visual Studio say “Code Coverage is not enabled for this test run” when it's enabled?

In Visual Studio, I just created a simple Unit Test to test a method I wrote. I wanted to check the code coverage, but the Code Coverage window only ever states that "Code Coverage is not enabled for ...
9
votes
3answers
3k views

Code coverage tools for VS 2008 [closed]

We're getting our feet wet with unit testing in VS 2008 Professional Edition and have hit what might be a pretty large snag: there appears to be no way to determine code coverage in this particular VS ...
8
votes
16answers
620 views

How to interpret 'test every scenario you can think of'

I was recently tasked to, "Test every scenario you can think of and try to break the component" What might be sensible in 'everything' when the application is a website? NOTE: This particular site ...
8
votes
3answers
1k views

Best practices for getting the most testing coverage with Django/Python?

My tests are seriously lacking and I don't have a whole lot of faith in them. What are some of the best practices for getting the most testing coverage I can using Django/Python? I've been taking a ...
7
votes
4answers
489 views

How do I test code that should never be executed?

Following method shall only be called if it has been verified that there are invalid digits (by calling another method). How can I test-cover the throw-line in the following snippet? I know that one ...
7
votes
8answers
2k views

Unit Testing and Code Coverage Frameworks for .Net?

I am about to start a new project and am looking around for both a unit testing framework and some sort of code coverage profiler. I've used the unit test framework in Visual Studio Pro in the past ...
7
votes
2answers
779 views

Ensuring code coverage in unit testing?

We have noticed that even though we have a lot of doctests in our Python code, when we trace the testing using the methods described here: traceit we find that there are certain lines of code that ...
7
votes
3answers
2k views

Does C1 code coverage analysis exist for Ruby?

I'm currently using Rcov to get C0 code coverage analysis for a rails project that I'm working on. However, those results are practically meaningless- I have 100% coverage according to rcov (as it ...
7
votes
3answers
2k views

How do code coverage tools work in different languages?

Most established languages have solid test coverage tools available for them, but the depth of functionality differs significantly from one to another. Also, all the various VMs and compilers have ...
6
votes
6answers
373 views

Unit testing infrastructure for a python module

I'm writing a python module and I would like to unit test it. I am new to python and somewhat bamboozled by the options available. Currently, I would like to write my tests as doctests as I like the ...
6
votes
1answer
2k views

Creating test run configurations in VS 2008

I am working with an n-tiered architecture in Visual Studio 2008 (Developer Edition), and I have run into an issue. We are running unit tests on every method of our services layer, and I am ...
6
votes
2answers
1k views

What is a good, free C# unit test coverage tool?

I'm looking for a tool that I can run against my code base to determine which areas of my code are covered by NUnit tests I've written. I would appreciate any suggestions at all, and example usage if ...
6
votes
1answer
349 views

Is branch coverage the same as decision coverage?

I'm learning software testing right now, and I found that there are a lot of coverage criterias out there. And something just confused me. Is branch coverage equals to decision coverage? wiki said ...
6
votes
3answers
637 views

is there a code-coverage tool for the TSQL sproc unit tests?

I am looking for a unitttest and code-coverage tool for TSQL sprocs. Can anyone recommend a good one? Commercial or free.
5
votes
5answers
242 views

Dealing with TDD / Unit Testing fatigue

So I'm getting used to TDD, but I've come across an unexpected problem: I'm getting really tired of 100% code coverage. The tests are getting more tedious to write than the code itself, and I'm not ...
5
votes
3answers
476 views

Using PHPUnit code coverage with interfaces

I'm using PHPUnit (3.6.7) to test and provide code coverage reports on my application, everything is set-up and working as expected. I have complete coverage for all of the code except for my ...
5
votes
4answers
749 views

How can I use Mock Objects in my unit tests and still use Code Coverage?

Presently I'm starting to introduce the concept of Mock objects into my Unit Tests. In particular I'm using the Moq framework. However, one of the things I've noticed is that suddenly the classes I'm ...
5
votes
2answers
153 views

Coverage vs reachable code

Q: how to detect real test coverage ? I've noticed one problem with code coverage metric and test quality: 100% code coverage doesn't mean that code is really tested. Sometimes test gives 100% ...
5
votes
3answers
421 views

Code coverage tools for C

I am using CuTest for unit testing and would like to get information about code coverage. Are there any code coverage tools available for C? Thanks
5
votes
1answer
845 views

PHPUnit - exclude some directories from code coverage in command line

I am working on project that based on Yii framework, and we have many tests that we added programatically to test suite, so we are not using phpunit.xml file to configure tests. The question is, how ...
5
votes
2answers
299 views

Effective Unit Test Coverage (and what should actually be tested?)

I see there's been several questions based off this topic, but I have some specific examples that I'm struggling with. I hope someone can help me here, as I'm new to test driven development and unit ...
5
votes
3answers
5k views

TFS 2010 Build Automation - Enabling Code Coverage

How do you enable code coverage for unit testing in TFS2010 automatic build? In Visual Studio 2010 we enabled Code Coverage for our test projects (Test --> Edit Test Settings --> Local Test Settings ...
5
votes
1answer
341 views

Code Coverage on Lambda Expressions

I'm seeing a pattern throughout my code where the lambda expression is showing as not covered in code coverage, the debugger DOES step through the code and there are no conditional blocks. public ...

1 2 3 4 5
15 30 50 per page