Skip to main content

Questions tagged [tdd]

TDD stands for Test-Driven Development, or Test-Driven Design. It is the practice of writing a unit test before writing code to satisfy it, in what is known as the Red-Green-Refactor cycle.

Filter by
Sorted by
Tagged with
1 vote
1 answer
106 views

I’m working on a three layers architecture backend (Laravel). Here’s the context: I have a PasswordService responsible for updating a user’s password. and a Otpservice responsible for verifying/...
aymen's user avatar
  • 21
3 votes
2 answers
233 views

Say I have a method that expects data to be in some form to perform accurately. In the actual service/application flow, that data is formed upstream in other methods or services. How can I ensure the ...
Jason's user avatar
  • 33
0 votes
4 answers
233 views

Lets say I have an API with two functions: CreateNewMachine(CreateMachineCommand createMachine); EditExistingMachine(EditMachineCommand editMachine); The internal logic of both functions should be ...
David Mason's user avatar
1 vote
1 answer
176 views

What are the use cases of TestOf? I'm new to NUnit testing and from what I have seen, most people don't use this attribute that much. From my experience, TestOf helped me to quickly identify what ...
LNTR's user avatar
  • 43
0 votes
4 answers
335 views

Let's say that I've been iterating over my feature A with TDD. After several red-green-refactor cycles, I ended up with a nicely polished implementation with a part of the SUT encapsulated into some ...
Maciek Czarnik's user avatar
0 votes
2 answers
2k views

I'm doing some TDD practice for my own learning. I'm trying to figure out how to transparently set up private properties of an object to support testing. I have a binary tree node: internal class Node ...
mike1952's user avatar
  • 109
38 votes
12 answers
8k views

We all know the standard TDD cycle: I first write a unit test, the smallest unit test that fails; then I write some production code, again the smallest amount of production code that is sufficient to ...
gaazkam's user avatar
  • 4,529
11 votes
4 answers
3k views

I'm trying to practice BDD by applying it to a simple problem—in this case, the flocking algorithm, better known as "boids". Before any of the rules (cohesion, alignment, etc.) comes the ...
verified_tinker's user avatar
1 vote
1 answer
78 views

We currently have an architectural setup as described below. Our plan is to conduct a load test, but we face a challenge due to the high cost of real switches. We have two options: either build the ...
Yiffany's user avatar
  • 111
0 votes
4 answers
534 views

I'm currently scratching my and my colleagues head about whether and how we could test SyncService::syncFoo in any meaningful way that does not involve basically recreating the whole call tree as ...
gries's user avatar
  • 239
-1 votes
3 answers
138 views

About tests: I have the following view on nomenclature: Unit tests are the kind of testes where you have a function ExtractBacon, where there is a function with an entry parameter Pig and a return of ...
sergiol's user avatar
  • 157
0 votes
3 answers
296 views

Suppose you have been put in charge of an already existing project. As you are starting to familiarize yourself with the repository, you notice a few technical debt issues (insufficient test coverage, ...
EdG's user avatar
  • 11
9 votes
5 answers
3k views

In university, we were introduced to the two terms "verification" and "validation". The definitions can be summarized as follows: Validation checks that the specifications and ...
BenjyTec's user avatar
  • 201
2 votes
2 answers
835 views

There are two schools of thought on how unit tests should be written. The first is the Classical/Chicago school, which focuses on the isolation of unit tests, describes a unit as a class or set of ...
B-Rad's user avatar
  • 203
2 votes
1 answer
388 views

I've been working on a personal project for some time, and I believe that I'm at that point where, if I don't embrace unit tests (and ideally TDD) now, it may be too late, so I want to make the right ...
Pablo's user avatar
  • 29
2 votes
6 answers
4k views

Well, I'm developing a personal project using TDD and Clean Architecture, and I chose to build an abstract class to gather all use-cases behavior in one single class. My question is: What you think ...
Gabriel Antonio's user avatar
0 votes
1 answer
459 views

Well, we all know the main concept of TDD: write a failing test, then implement the testing component to make your test pass. I've been working on a personal project in Clean Architecture following ...
Gabriel Antonio's user avatar
0 votes
4 answers
849 views

Im making a website and trying to learn Test Driven Development (TDD) I'm doing one of CS50 projects, were we need to make a website to trade stocks. I decided to use this oportunity to learn TDD. I ...
Portho Games BR's user avatar
0 votes
2 answers
227 views

In front-end projects(made in frameworks like Angular or React), when we correctly encapsulate complex functionalities, the components that really have some relation to the business logic normally ...
Vitor Figueredo Marques's user avatar
1 vote
3 answers
2k views

I'll be using Uncle Bob's terms, so i'll call the use cases "interactors" and the domain entities "entities". As far as I understand, the most specific business rules that are most ...
Jordi Pagès's user avatar
-4 votes
3 answers
219 views

I find when I am programming and I fix a bug in one area of the codebase, sometimes something slightly related or maybe unrelated breaks, and as a result I usually copy and paste the fix to a ...
jackw11111's user avatar
5 votes
2 answers
780 views

How much (if any) unit tests should be written when you start a new templated project? In particular, let's take as an example a typical .net framework template for asp.net mvc or other similare ones ...
Erik Mm's user avatar
  • 59
2 votes
5 answers
957 views

Let's say I want to add tests to a software that has some flaws/bugs. I want to add the tests before I fix the bugs. And I want to actually merge them in the main branch, not just have them in a ...
donquixote's user avatar
2 votes
2 answers
472 views

I'm learning and trying TDD recently, and I constantly encounter a situation when I need to ditch my current test because it's too broad. I don't know how to deal with it. To be more specific, let's ...
Searene's user avatar
  • 139
5 votes
3 answers
1k views

I am unsure where/how to specify the behavior of a mock in a test scenario when using the Given-When-Then syntax. It seems to me both Given and When could be correct. Consider the following example: ...
slingeraap's user avatar

1
2 3 4 5
14