CARVIEW |
Select Language
HTTP/2 200
date: Wed, 30 Jul 2025 23:19:10 GMT
content-type: text/html; charset=utf-8
cf-ray: 967894514911b277-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=dd0388d3-7e6a-49f5-9f7b-25045930fda3; expires=Thu, 30 Jul 2026 23:19:10 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: d3c11281-ef29-44a2-ac0e-6cd65bf8a425
x-worker-origin-response-time: 672000000
x-dns-prefetch-control: off
set-cookie: prov=dd0388d3-7e6a-49f5-9f7b-25045930fda3; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=T4.6lIiDPkPg7vekeybHWZb6ci2KSs72jdfCA.WGduY-1753917550-1.0.1.1-XYIbvXMhfxR1doO9RFF2aGWzAutqRm5M.36SQeO5JLsSxGOcVo9UUEtzBpSpuC8Ttv3CUWbYOaHNNq_p4Lc75xKmOS2y.tDpDHgzRonAYpo; path=/; expires=Wed, 30-Jul-25 23:49:10 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=L.4vp9PuzOe9HIk9YTwxw6ry9bSkVHIiP0edZVJ5TKs-1753917550969-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'unit-testing' Questions - Software Engineering Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more.
View results.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions 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.
1,805 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
2
answers
131
views
Test a script reading from external source
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 ...
4
votes
4
answers
211
views
Modeling superstate and substate combinations in DDD
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. ...
9
votes
10
answers
2k
views
Efficiency of improving testability versus adding unit tests
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, ...
1
vote
5
answers
500
views
Code reusability/inheritance introduces pointless testing
Say I have a bunch of classes that imitate cars: SportsCar, Truck, and SUV. All of these classes share some public methods like start() and stop() which they inherit from an abstract class Car. While ...
2
votes
4
answers
182
views
Is it possible to do black box tests when I inject dependencies in the class?
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 ...
4
votes
3
answers
530
views
Clearing static state before testing each method
My SUT class depends on external static state (which generally should be avoided, I know).
How do I make sure my tests do not depend on their order of execution?
I mean other by introducing some reset(...
0
votes
2
answers
156
views
Is Spring Boot Unit Test Coverage with Integration tests only a bad practice?
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 ...
13
votes
10
answers
3k
views
Does unit testing spot bugs that QA testing typically does not?
By QA testing I mean like say integration testing, system testing, regression testing, user acceptance testing and the like. If unit testing is skipped altogether would bugs that typically are spotted ...
0
votes
2
answers
186
views
Testing C# app backed by MSSQL database and Entity Framework - seeking advices for going with "test double" approach
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 ...
3
votes
2
answers
215
views
Ensuring unit test data stays accurate
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 ...
2
votes
3
answers
393
views
How to unit test private method that is used by many public methods under a common API without duping the tests
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 ...
0
votes
6
answers
275
views
How to unit test private method that is used by several public methods without duping the tests
Lets say I have a class with two public methods and one private method.
The private method is used by both public methods and unit tests that are written against either of the public methods, could ...
0
votes
4
answers
202
views
Avoid Test duplication if a function created via TDD has an implementation detail that is later used in other functions
Lets say I have an API with two functions:
CreateNewMachine(CreateMachineCommand createMachine);
EditExistingMachine(EditMachineCommand editMachine);
The internal logic of both functions should be ...
3
votes
3
answers
184
views
How to unit test a function (Windows API) that launches processes?
I've been tasked to use the Windows API (CreateProcessA, ExitProcess) to write a function that'll create, launch, and terminate some in-house applications (app1.exe, app2.exe). The two apps are fire-...
1
vote
1
answer
138
views
NUnit testOf attribute usage
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 ...
- The Overflow Blog
-
-
- Upcoming Events
-
2025 Community Moderator Electionends August 13
- Featured on Meta
-
-
-
Related Tags
testing × 482
tdd × 356
c# × 190
integration-tests × 156
mocking × 140
java × 117
design × 89
python × 67
c++ × 60
dependency-injection × 55
.net × 54
object-oriented × 53
javascript × 50
php × 46
refactoring × 44
design-patterns × 39
test-coverage × 36
bdd × 35
database × 28
integration-testing × 28
architecture × 27
code-quality × 24
junit × 24
more related tags
Hot Network Questions
- Efficient generation of pseudorandom permutation over a small domain
- Is it common practice to run neutral and ground to the same bar?
- The dative plural form "den Einen" in Schopenhauer's 19th-century German – can "ein-" be used for plurals?
- GraphQL Search Not Working for Multilist Field (Category) in Sitecore JSS
- How was the Universal Pictures 1936 opening logo created?
- Is a normality test always performed on errors and not on raw data?
- Puzzlin’ Puzzle
- Taking small amounts till there's nothing left
- What were WW2 electronics wires made of?
- Wolf and sheep probability
- Why did many arcade games have separate sound CPUs?
- US firm charging a US resident in foreign currency - legality?
- What is known about the third time derivative of the expansion of the Universe?
- Was Caiaphas a Prophet or a Villain? (John 11:51)
- How to create a Face Group from selected faces, similar to a Vertex Group
- How can I secure an old iron gate with a padlock?
- Seven-dimensional cross product
- How loud were the top-of-the-range propeller aircrafts like the Lockheed Constellation when commercial jet travel appeared?
- How quickly can you solve the Change Change game?
- Nested doghnut chart
- Eye-shaped arrow tip
- Novel with fog on an alien world and a labyrinth
- Eleven Special Flashcards
- Advantage of launching a rocket from the Equator