Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.

learn more… | top users | synonyms (1)

1
vote
1answer
51 views

Are HSQLDB unit tests an anti pattern?

HSQLDB is great. It (also) has an embedded mode (no dedicated server needed), which allows for quick prototyping of stuff like Proof of Concepts, and it can also be great in production-ready ...
2
votes
1answer
141 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 ...
0
votes
0answers
58 views

Does Visual Studio enable me to selectively run test cases? [migrated]

How to segregate this? Say there is a module built with a contract (i.e. implements an interface). This is done so for unit test purposes and extensibility. Say there is a person (A) in my team ...
52
votes
9answers
3k views

Does it make sense to write tests for legacy code when there is no time to a complete refactoring?

I usually try to follow the advice of the book Working Effectively with Legacy Code, so I break dependencies, move parts of the code to @VisibleForTesting public static methods and new classes to make ...
0
votes
0answers
37 views

memory checker that allows uninitialized reads? [closed]

I'm trying to test a program with memory checkers. The program uses OpenSSL, and OpenSSL performs an uninitialized read when seeding the PRNG. I can't use Valgrind because its not possible to write ...
3
votes
7answers
197 views

How to measure that a team is doing Test Driven Development

My team is considering a department goal of doing Test Driven Development next (fiscal) year. TDD sounds good and my manager is on board. The only problem is measurement. Our company rules require ...
1
vote
5answers
308 views

Should unit-tests be entirely self-contained? [duplicate]

As the title suggests my question is whether or not unit-tests should be entirely self-contained or can one rely on the results yielded by previous tests? What I mean, in case that it isn't entirely ...
15
votes
7answers
579 views

Should I have unit tests for known defects?

If my code contains a known defect which should be fixed, but isn't yet, and won't be fixed for the current release, and might not be fixed in the forseeable future, should there be a failing unit ...
4
votes
2answers
129 views

Unit tests tactics

The only unit tests tactic I'm familiar with is comparing against golden data _ a predefined set of input data for which output is known (preferably including corner cases). I cannot think of any ...
0
votes
1answer
96 views

Unit testing methods with logical dependencies on other classes

Suppose I have an interface declaring the following method signature: SearchResults SearchProducts(string type, string filter, string anotherFilter); Inside a concrete implementation of this, I ...
1
vote
1answer
80 views

What are the valid test cases for method calls within if-else condition

I have a discount service that gets called if certain conditions are met. I need to write test cases to check if the discount service is called. My doubt is checking if the discount service is NOT ...
3
votes
1answer
115 views

Python 2.7 - What are good unit tests to cover the use case of rolling a die?

I'm trying to get to grips with unit testing. Say we have a die which can has a default number of sides equal to 6 (but can be 4, 5 sided etc.): import random class Die(): def __init__(self, ...
0
votes
0answers
19 views

Model Driven Design with Bean Validation

If I have a rich domain library that gets included into a Java web application, but I want to achieve a level of dependency isolation with that domain library such that it is possible to build and ...
0
votes
0answers
375 views

How to integrate unit testing process into legacy software development process?

I'd like you to share your insights of how have you successfully turned the direction of rotting legacy code base to modular application design where it's easy and useful to add unit tests? What I'm ...
0
votes
2answers
69 views

How should I test the functionality of a function that uses other functions in it? [duplicate]

Suppose there is a function get-data which returns a map of information about the id of the user passed in. now this function uses 3 functions source-a, source-b and source-c to get three different ...

15 30 50 per page