The tag has no wiki summary.

learn more… | top users | synonyms

26
votes
7answers
4k views

What should you test with unit tests?

I'm freshly out of college, and starting university somewhere next week. We've seen unit tests, but we kinda not used them much; and everyone talks about them, so I figured maybe I should do some. ...
19
votes
4answers
2k views

How to drastically improve code coverage?

I'm tasked with getting a legacy application under unit test. First some background about the application: It's a 600k LOC Java RCP code base with these major problems massive code duplication no ...
13
votes
3answers
1k views

How would you test Google Maps “Get Directions” feature?

(I imagine this would be a good interview question, but in my case it's more pragmatic than that.) We have a large & complex application that models an extremely long and sophisticated chemical ...
12
votes
5answers
842 views

How can I design test cases to cover code based on random events?

For example, if the code generates a random int from 0-10, and takes a different branch on each outcome, how can one design a test suite to guarantee 100% statement coverage in such code? In Java, ...
12
votes
2answers
498 views

How do I know if I have enough unit test coverage to remove an integration test?

I'm working on a legacy system (by that I mean it was written without tests). We've tried to test some of the system by writing integration tests that test functionality from the outside. This ...
11
votes
7answers
893 views

Is test coverage an adequate measure of code quality?

If I have some code that has 80% test coverage (all tests pass), is it fair to say that it's of higher quality than code with no test coverage? Or is it fair to say it's more maintainable?
9
votes
10answers
863 views

Any tools/suggestions on how to refute code coverage quality argument

Now I know people could consider this question duplicate or asked many times, in which case I would appreciate a link to relevant questions with answer to my question. I have been recently in ...
6
votes
4answers
402 views

Unit testing internal components

To what extent do you unit test internal/private components of a class/module/package/etc? Do you test them at all or do you just test the interface to the outside world? An example of these internal ...
5
votes
4answers
212 views

Is it realistic to ask your team to take on a 100% automated test coverage goal as a stretch task?

In a financial services environment - is it realistic to ask your team of ten programmers to take on a 100% automated unit and integration test coverage goal as a stretch task for a legacy java system ...
5
votes
2answers
3k views

How do you handle measuring Code Coverage in JavaScript

In order to measure Code Coverage for JavaScript unit tests, one needs to instrument the code, run the tests and then perform post-processing. My concern is that, as a result, you are unit testing ...
4
votes
5answers
2k views

Is path coverage stronger than condition coverage?

I have encountered (even in literature) two contradicting opinions related to path vs condition coverage (not branch or edge!). Some say Path coverage is stronger than the condition coverage, some say ...
4
votes
2answers
113 views

Is it ok to write “extra” unit tests?

My understanding of how TDD should work is that you write a failing test for the next bit of functionality you want to add to a function or object, code until the test passes and then write the next ...
3
votes
5answers
675 views

Best practice for code coverage of empty interface methods

Given a class that implements an interface, but does not need all of the methods implemented, what is the best practice for unit testing this class with respect to code coverage? - or is it considered ...
3
votes
3answers
358 views

Is unconditional code considered a branch?

Having simple code like this: int A=5; object X=Console.ReadLine() if(Condition) DoSomething(); else DoStuff(); DoSomethingElse(); Some sources say there are actually 4 branches: First ...
3
votes
1answer
119 views

Verification for value of test standards

We are currently developing a concept for our tests standards. Up until now, we don't have standards. All we do is to tell the developer to write tests. Now we have the following basic idea: We will ...
3
votes
3answers
6k views

Branch vs decision coverage question

ISTQB does not distinct between these (it reads "Branch/decision coverage") but some sources do say it is different. I would have two question. The essential one is about the difference. And the other ...
2
votes
1answer
381 views

equals and hashcode methods autogenerated, is it always a good practice?

Preamble: Let's say I aim to cover all my classes with test coverage. Despite the common opinion (expecially in Java community) to "not pay too much attention to Cyclomatic Complexity (CC) and code ...
2
votes
4answers
319 views

Reasonable test coverage requirements when dealing with a contractor?

We're outsourcing some work to an external developer, so I'm busy writing up a contract about what constitutes a deliverable. So far I require that the code is shipped with automated tests. But, ...
2
votes
2answers
228 views

Unit test and Code Coverage of Ant build scripts

In our development environment We have more and more build scripts for ant to perform the build tasks for several different build jobs. These build scripts sometimes become large and do a lot of ...
1
vote
5answers
311 views

How to unit test a missing case in a switch statement where all cases are true

I often use enum types in my code with a switch to apply logic to each type. In these cases it's important that each enum has code implemented. For example; public enum eERROR { REQUIRED, ...
1
vote
1answer
2k views

Condition coverage for If(A && B) - measuring the input or code exercised?

I have been studying condition coverage for last few days. In a book "The Art of Software Testing" they highlight that it does not assure decision coverage, because for example IF(A && B) ...
1
vote
1answer
92 views

Does condition coverage subsume edge coverage?

I'm a little bit confused about code coverage criteria; especially condition and edge coverage. As stated in this book, edge coverage does not subsume condition coverage; BUT my lecture material ...
1
vote
1answer
212 views

How to get good scenario coverage in performance benchmarks?

If it is relatively easy to get good code coverage from profiling (because profiling tells you which functions are/aren't called, how many times, and with what parameters), how do I get good ...
1
vote
2answers
209 views

What is “condition testing” (as defined by the ISTQB Syllabus) actually good for? [duplicate]

I am currently checking through the syllabus for the ISTQB "Technical Test Analyst" certification. This syllabus (henceforth called "TTA syllabus") contains a chapter dedicated to "condition testing" ...
0
votes
1answer
145 views

What the white box testers create test cases against?

I'm wondering, what are the white box testers using to create test cases? The actual code? Some kind of diagrams? I mean, if I am given a task to create test cases for complete branch coverage, is it ...
0
votes
1answer
52 views

How do you define a node and an edge when talking about McCabes Complexity?

I am trying to understand the formula, but I am a bit in doubt how exactly you define edges and nodes. Edges seem to be every possible exit from a statement and nodes seem to be statements, is this ...
-1
votes
1answer
118 views

Approach to cover all the cases in Unit Tests [duplicate]

I am new to Unit Testing and i am able to write them but my problem is I am not sure that I have covered everything in Unit Tests. What could be the approach for testing some functionality in a code?
-4
votes
1answer
116 views

How does code coverage work?

Specifically, what is contained inside code coverage data (.nccov or xml file) and how is an html report generated by this? Does the coverage data not include the actual percentage of code covered? Is ...