Linked Questions

2 votes
3 answers
2k views

I'm currently trying to unit test a behavior which, in some very particular cases, returns B instead of A. It may depend on the value of 3 different attributes for example. How should I test this? ...
leokhorn's user avatar
  • 624
1 vote
1 answer
6k views

I am new to Junit. I have a class with four methods. I am creating a test class with test cases. Can I have a test case that uses more than one methods of testing class or there should one test case ...
want2learn's user avatar
0 votes
1 answer
420 views

This problem arose whilst writing a simple 3D vector class. The class contained methods (Java, so no operator overloading) for addition, subtraction, multiplication, and division. These methods ...
the6p4c's user avatar
  • 103
1 vote
0 answers
67 views

Unit testing has been widely lauded as an indispensable part of software development, and TDD has many proponents. However, due to the combinatorial nature of various pieces of code, it can be ...
Celarix's user avatar
  • 139
31 votes
4 answers
3k views

In recent years, I have only written small components for people in larger projects or small tools. I have never written a unit test and it always seems like learning how to write them and actually ...
wilhil's user avatar
  • 1,002
0 votes
11 answers
990 views

Hello I will try to explain what is my actual understanding of tests and why I have problems to grasp it's utility. Even if I try my hardest to understand the concept of TTD, unit test, integration ...
Quentin O's user avatar
12 votes
3 answers
1k views

My employers runs a monthly unit testing day competition. One entire day is dedicated to writing unit tests -- obviously we do more testing throughout the month, but this is an entire day -- and the "...
Shaun's user avatar
  • 249
6 votes
3 answers
1k views

One of the things I struggle with when unit testing is deciding what behaviors to actually test. I think part of my struggle stems from how most unit testing tutorials don't use good examples of ...
lecrank's user avatar
  • 249
2 votes
2 answers
614 views

I m actually studying Unit testing, reading some articles on the internet and trying to understand how it works exactly, but it's not very clear for me actually. What should I test ? I have seen ...
mfrachet's user avatar
  • 1,591
5 votes
2 answers
436 views

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 ...
superM's user avatar
  • 7,383
6 votes
2 answers
545 views

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 ...
samt1903's user avatar
3 votes
3 answers
240 views

Given a system with static permissions (1 permission for every action that can be made: create a resource, update a resource, etc), and dynamic roles (can be created and assign permissions to it ...
Christopher Francisco's user avatar
1 vote
4 answers
1k views

Sometimes we have code like this: private static final List<Goat> INEDIBLE_GOATS = [GOAT_A, GOAT_B, GOAT_C] void eatGoat(Goat goat) { if(INEDIBLE_GOATS.contains(goat)) { throw new ...
Winston Ewert's user avatar
0 votes
0 answers
51 views

If I create a function to calculate the square root of a number, I suppose i should write a single unit test (maybe two, to test how it handles negative numbers). But what if I have a function which ...
Jakob Busk Sørensen's user avatar