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

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
1 vote
1 answer
227 views

OO design - Process that relies on the current state of objects

We have a CAD software extension, where you can draw products like walls, doors, windows, etc., and you can export the drawing as an order, which contains the parts and costs. As part of this export, ...
Divan's user avatar
  • 369
0 votes
3 answers
195 views

In unit testing, what is the difference between the arrange step in the AAA-pattern and a fixture?

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
4 votes
3 answers
261 views

The applicability of functional core - imperative shell to a cli program which contains a wrapper around a binary

Not long ago while I was exploring for solutions to test without mocks I've found out about the functional core, imperative shell architecture. It sounds great, I also think that it would play nicely ...
 sentientbottleofwine's user avatar
2 votes
2 answers
152 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 ...
JF Meier's user avatar
  • 700
4 votes
4 answers
226 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. ...
Afelium's user avatar
  • 51
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, ...
Johan Thiborg-Ericson's user avatar
1 vote
5 answers
540 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 ...
Ruben Rundström's user avatar
2 votes
4 answers
194 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 ...
Álvaro García's user avatar
4 votes
3 answers
763 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(...
Sergey Zolotarev's user avatar
0 votes
2 answers
208 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 ...
Mary's user avatar
  • 3
13 votes
10 answers
4k 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 ...
Wes's user avatar
  • 335
0 votes
2 answers
214 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 ...
mguijarr's user avatar
  • 226
3 votes
2 answers
228 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 ...
Jason's user avatar
  • 33
2 votes
3 answers
434 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 ...
David Mason's user avatar
0 votes
6 answers
298 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 ...
David Mason's user avatar

15 30 50 per page
1
2 3 4 5
121
Morty Proxy This is a proxified and sanitized view of the page, visit original site.