Skip to main content

Questions tagged [unit-testing]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
134 views

I am building an API project, where I have a controller called C1, which calls service S1. Within this service, there are multiple method invocations to services S2and S3 and S4, as well as a call to ...
Héctor Iglesias's user avatar
0 votes
1 answer
84 views

I've been working on an implementation of a service, and have found that there are a number of operations where I need to read from a database to provide a caller with certain data or objects. In-line ...
Lily Smith's user avatar
0 votes
3 answers
205 views

When writing unit tests, I always doubt whether I should put preconditions into the unit test itself (as the "arrange" step) or in a fixture. Is there a difference between the two? When ...
PieterV's user avatar
  • 233
2 votes
2 answers
163 views

I regularly write scripts and small tools that read data from external servers. I am still not sure what is the most efficient and effective way to test them: Probably the most effective way would be ...
JF Meier's user avatar
  • 700
9 votes
10 answers
2k views

My team is going to add unit tests to old code without modifying it, to pave way for future design improvements. One of the short term goals is to also reduce the number of newly introduced bugs, ...
Johan Thiborg-Ericson's user avatar
2 votes
4 answers
200 views

This is my case. I have a class in which I inject a service as dependency, an IService. I want to test one method of this class. This method use one of the methods of the service. Now I want to test ...
Álvaro García's user avatar
0 votes
2 answers
244 views

I have recently come across a few codebases at work where the previous developers chose to reach the >80% coverage criteria by writing only integration tests with the @SpringBootTest annotation ...
Mary's user avatar
  • 3
0 votes
2 answers
233 views

I am new to C#, and Windows (coming from Python, Linux background). I need to add tests to an existing C# codebase, which relies on a MSSQL database and Entity Framework. In my old days when testing ...
mguijarr's user avatar
  • 226
2 votes
3 answers
461 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
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
5 votes
5 answers
715 views

I am working on a refactor on a certain package (I can give details if asked). The package involves a clever lazy evaluation of a sort of nested sequence of arithmetic operations. If the numerical ...
Jagerber48's user avatar
0 votes
2 answers
444 views

According to the Wikipedia entry for Unit Testing, it is defined as a technique for testing components of a system in strict isolation from each other, and it is described as having been expressly ...
Mike Nakis's user avatar
  • 32.8k
12 votes
9 answers
8k views

I read an article about unit testing by Vladimir Khorikov, written in 2020. Here is The Article https://vkhorikov.medium.com/dont-mock-your-database-it-s-an-implementation-detail-8f1b527c78be It said ...
christian tiovanto's user avatar
1 vote
1 answer
606 views

I have a service method called acceptOrDenyJoinRequest that follows a logic similar to this flowchart (green boxes are ignored in code, and the light gray box calls an external service). According to ...
Saimur Rahman's user avatar
1 vote
3 answers
486 views

Over the years it's becoming clear to me what's an integration test and what's a unit-test. I understand some people more or less settle on their definitions but to be brief I consider testing one ...
nicholaswmin's user avatar
  • 2,134
2 votes
5 answers
498 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
4 votes
8 answers
3k views

For example, if the change is "return users' full names instead of just last names", is it worth it to add a test for it? Would it make the test suit fragmented and confusing? Context: My ...
imcoding's user avatar
3 votes
2 answers
688 views

I'm creating tests for our .Net 8 API. We use MySql for data storage and CQRS pattern for queries. In my personal opinion, I shouldn't use the real database for testing, because you will use an ...
Diego Perez's user avatar
2 votes
1 answer
784 views

When discussing the testing approach, we had disagreements. We develop software that we package into an image and distribute. We have two suggestions for testing: Build a separate image with a test ...
Vladimir's user avatar
1 vote
3 answers
826 views

This is something that I've heard a number of opinions and theories about, but I'm still torn on how to go forward. For context, this particular issue deals with the following technologies, in case ...
CrystalBlue's user avatar
3 votes
1 answer
278 views

I am writing unit tests for my SwiftData application. Currently, I am using in-memory database, which get reset after every test. What benefits will I gain if I start using real database? My main ...
user19037628's user avatar
-3 votes
1 answer
112 views

We have built a library which can handle RESTful requests based on configured endpoints. A fluent builder is being used to create endpoint definitions (configurations). These definitions are bound to ...
Wilko van der Veen's user avatar
4 votes
5 answers
414 views

A follow up question to How do unit tests facilitate refactoring without introducing regressions?. I said that integration tests test the behavior of the code, while unit tests, being tied to ...
gaazkam's user avatar
  • 4,529
0 votes
1 answer
114 views

I work with a integration project based on Publisher/Subscriber pattern whose subscriber end feeds a staging database which stores data to be pushed to another application. The staging database has ...
Valmir Cinquini's user avatar

1
2 3 4 5
37