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
115 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
  • 23
4 votes
4 answers
248 views

I am designing an analytics application using domain driven design and test driven development. I am having difficulty modeling the following requirement: The application shows a workitem's state. ...
Afelium's user avatar
  • 51
3 votes
2 answers
234 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
2 votes
3 answers
462 views

This question is a more specific version of the one I posted last week. Let's say I have a complex data structure that is posted into a bunch of different services. The interface of all services looks ...
David Mason's user avatar
1 vote
4 answers
234 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
3 votes
7 answers
624 views

I am currently reading the (not yet completed) ebook "Test Driven Developlment - Extensive Tutorial" by Grzegorz Gałęzowski. There is a chapter featuring Mark Seeman's idea of constrained ...
Döharrrck's user avatar
1 vote
1 answer
179 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
2 votes
5 answers
499 views

I was exploring TDD, specifically the Outside-In TDD pattern, where we need to write the acceptance (integration) test and then jump on to granular unit tests to implement the feature and make the ...
Jignesh M. Khatri's user avatar
0 votes
4 answers
338 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
2 votes
3 answers
472 views

I admire Bob Martin's Clean Code. Lately, however, I realized an apparent contradiction. One of the three rules of TDD, which Bob Martin advocates for in his book, is to never write more code that is ...
Sergey Zolotarev'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
3 votes
3 answers
1k views

Suppose I had some Manager class that I need to change in regards to existing functionality by removing code. The Manager always sends an initial message after a connection was established to do an ...
Late347's user avatar
  • 55
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
0 votes
3 answers
473 views

We have a piece of code that decorates an interface to transparently add retry logic. Inversion of Control configuration service.AddOurRestApiClient() .AddResilienceHandler("Retry", ...
LostInComputer's user avatar
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
3 answers
483 views

I've been working at this company for about a year now. it's a growth company working in B2B. I'm one year out of university, with a major in computer science. I work in the web team, using an Angular ...
Jeremaia Scott'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
1 vote
2 answers
254 views

I am trying to get a better understanding of TDD. From a quick google I've found this: In layman’s terms, Test Driven Development (TDD) is a software development practice that focuses on creating ...
user8469759's user avatar
0 votes
4 answers
535 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 vote
3 answers
250 views

I was programming today and encountered something that just feels like I'm doing something wrong (maybe?). I've encountered this situation before, but I wanted to reach out and ask if there's a better ...
jrgilman's user avatar
  • 121
-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
2 votes
2 answers
700 views

I am talking about these two testing strategies : Have a pyramid of tests (with many more unit tests than high-level tests), because high level tests are harder to maintain and slower (see also : ...
Tristan's user avatar
  • 207
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
2 votes
3 answers
261 views

Let's suppose I want to follow TDD (Test driven development) and I want to implement a class that is supposed to return a considerable object. It starts to get really complex in my opinion and doesn't ...
Nmaster88's user avatar
  • 167
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
5 votes
7 answers
637 views

Another name for this question could be: How to TDD the main function? My situation: I'm writing a program from scratch that runs a sort of simulation, and I want to apply TDD to the whole development ...
charlieshades's user avatar
2 votes
2 answers
837 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
13 votes
4 answers
2k views

When in the refactoring step of a TDD process, if we "factor out" some common functionality from two (or more) code modules, how do we avoid that "factored out" code not being ...
Rob Gilton's user avatar
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
2 answers
336 views

I'm following roughly the TDD style as explained in the "Obey the Testing Goat" book: You have a functional test for your (Django, in my case) web app that tests the observable behaviour via ...
Lagerbaer's user avatar
  • 556
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
0 answers
79 views

How do I solve this riddle of contradicting "good practices" to properly cover my app with unit-tests? These are principles I found about writing unit-tests: Pyramid of testing says unit-...
Gherman's user avatar
  • 945
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
1 answer
203 views

I have a domain entity called a "Booking Window" that has a Start Date and End Date, and defines a period in which a Member can make a Booking.  The business is a mobile car wash, and ...
Mike Hogan's user avatar
0 votes
4 answers
850 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
42 votes
3 answers
7k views

Doing TDD in a kata is simple. A red test, small amount of code, green test, and refactor. Repeat. And that's it. But, I work on a real application. With a REST controller, a service layer for ...
fluminis's user avatar
  • 583
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
3 votes
2 answers
228 views

I have to create a CLI application following TDD. The app should present a menu of items that can be added to an internal structure, and process those items according some rules. My question is if I ...
Allonsy's user avatar
  • 147
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
1 vote
4 answers
5k views

In a TDD (Test-Driven Development)-based Java project built by maven, lots of classes needs to be tested with text-based input files such as .csv. At the beginning, I put them into the src/test/...
Rui's user avatar
  • 1,935
-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
2 votes
3 answers
401 views

When writing tests for TDD is it good (or bad) practice to write multiple test for the same requirement ? If it's good how many times should it be repeated? If it's bad is it it the QA engineers work ...
Dhanushka Amarakoon'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
-1 votes
1 answer
275 views

This is my specific situation: I am following DDD and Event sourcing to implement my application (using C#). I have a Domain layer that contains Aggregates' implementation. I write unit tests for this ...
Mehrdad's user avatar
  • 99
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
103 views

I am trying to adpot a TDD process. I am a bit confused when it comes to testing an Api. I know for sure that the status and the response should be tested. But I am thinking if whether or not I should ...
Rami ZK's user avatar
  • 113
2 votes
2 answers
474 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
3 votes
3 answers
390 views

How should I go about using TDD and writing tests in this scenario? Suppose we have request handler classes. In short, a handler applies a "request" (e.g. Update details) to an entity then ...
ilitirit's user avatar
  • 147
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
3 votes
2 answers
787 views

When doing TDD "by the book" we should only -- as far as I understand -- write failing tests. This means tests for unimplemented functionality. I often find myself wanting to add tests for ...
kqr's user avatar
  • 379

1
2 3 4 5
14