Questions tagged [testing]
Verifying the behavior of a software system against the expected behavior of that system.
1,508 questions
0
votes
2
answers
125
views
Is integration-testing all services the best approach?
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 ...
7
votes
3
answers
387
views
How to test the parts of an application that cannot run in a test harness
I'm working on a program that runs as a sort of plugin to the Windows UAC prompt (and other similarly difficult environments). The testing situation is a bit abysmal. End-to-end tests are not possible,...
1
vote
2
answers
256
views
Testing GUI panel involving modal dialogs
Suppose you have a panel with a table, which I will call a pane.
The table has a toolbar above it, including an edit button.
Editing involves showing an editing dialog. It allows the user to edit the ...
-2
votes
4
answers
423
views
Terminology for a case where the same algorithm produces different results during tests?
I'm testing writing 10 MB of data to a server.
The expected result echoed back is 10485760 bytes.
160 writes of 65336 bytes.
Approximately 1 of 5 tests I get back 10420224 bytes in the test. 65536 ...
2
votes
2
answers
163
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 ...
14
votes
10
answers
4k
views
Is Dependency Injection useful when implementations are never expected to change?
Dependecy Injection makes mostly sense when using interfaces, since one of DI's strengths is to switch out implementations. It also decouples classes, since the consumer of the dependency does not ...
2
votes
3
answers
1k
views
Scope of integration tests
I'm programming a .NET WebApi application from services.
What is the scope of an integration test within the following schema?
Order creation scenario:
Order is created
-> stored in db
-&...
4
votes
4
answers
865
views
Best practice when working with code that uses current date and time
All programming languages have some method of referencing the current date and time. Examples...
now()
sysdate
DateTime.Now()
current_timestamp
Get-Date
In a professional or semi-professional ...
4
votes
1
answer
432
views
Best way to "verify" programs
As we know, determining the semantic properties of programs is an undecidable problem (e.g. Halting, commonly attributed to Turing). But tools such as static analysis (notably that of Clang/LLVM) are ...
3
votes
3
answers
207
views
Automation of workflow for automated testing
What are your opinions on writing "production" code to facilitate testing?
Specifically, the use case is this: we have a system with a multiple step workflow, where a few stages are done by ...
1
vote
1
answer
191
views
Automatic regression tests with change detection in blue/green deployments
Our product is almost fully deployed in CI, however one remaining part that we have to wrap up is still the regression (update: characterization / golden master) testing: So considering we have a blue/...
4
votes
3
answers
869
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
241
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 ...
3
votes
2
answers
233
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
4
answers
888
views
Microservices shared end-to-end testing: Which version(s) of other microservices to use?
Introduction
I am reading Building Microservices (second edition) by Sam Newman.
In chapter 9 the author highlights 2 problems when desiging end-to-end testing for microservices:
Which version of the ...
1
vote
1
answer
176
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 ...
2
votes
1
answer
514
views
Unit testing a Web Worker in JavaScript/TypeScript - Best Practice
I got assigned with writing unit tests for a class that instantiate a Worker inside in it's constructor. The code looks simmilar to this,
class SomeClass {
private _worker: Worker;
constructor(...
3
votes
3
answers
977
views
Testing for non-existence of a method in API
I am designing a fluent builder pattern API that branches and allows different options based on what has already been called.
For example: Build().Foo().Bar() is valid code, but Build().Baz().Bar() ...
6
votes
3
answers
326
views
Quality Assurance for Large SQL Script Releases
I'm often releasing large SQL scripts for projects and minor works - my problem is that there's nothing (except the logs) to indicate that the release was successful. There could be an object missing, ...
0
votes
1
answer
109
views
Scoped E2e testing on a microservice
As many, we use microservices in my company and there's some debate in my group whether a microservice has e2e tests on it's own.
I know e2e tests by definition are user flow tests.
Lets take for ...
0
votes
2
answers
444
views
Origins of Unit Testing in hardware?
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 ...
18
votes
10
answers
8k
views
Would a middle ground between unit and integration tests be optimal
I've read many posts about unit tests only testing one object/class and mocking of objects should only be for direct dependencies of the object under tests. The only other option discussed for ...
-1
votes
2
answers
162
views
Approach for implementing access permission tests for a large number of actions and multiple affiliations
I'm obviously having trouble creating a question that fits StackExchange guidelines in regard of opinions vs metrics. Any help to improve this question is highly appreciated.
I'm searching for a ...
-2
votes
3
answers
275
views
How to present serious flaws in third-party software to non-technical users
We have third party software being tested. Our software has to interface with this, hence my involvement. There are some things I consider serious technical flaws. I'd like to communicate these things ...
1
vote
5
answers
1k
views
Should you test configuration?
There's a (mis)conception that you don't have to test configuration
But what if your configuration is in the form of runnable code? What if it's not just static values?
I wrote an abstraction for ...
-1
votes
1
answer
186
views
Testability when API contract is fixed
Recently, I spoke to an Engineering Manager about some work I've done:
I had to implement a micro-service to a third party API contract (that they will call). Part of the requirement is to ...
1
vote
2
answers
299
views
How should you test classes that access localized properties?
Suppose you have a class that accesses a property (perhaps, it's a GUI class)
How do you test it in Java?
You can inject (and mock) a ResourceBundle
import javax.swing.JLabel;
import java.util....
0
votes
1
answer
560
views
How to avoid too much mocking in unit tests in a database-heavy method?
I have a service method, acceptOrDenyJoinRequest, which follows a fairly complex flow (as depicted in this diagram):
In my unit tests, the implementation details of this method are heavily reflected. ...
1
vote
1
answer
603
views
Should I skip unit tests if integration tests cover the same scenarios?
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 ...
0
votes
3
answers
483
views
Reusing constants in tests vs "magic" values
I'm writing tests to check if validation rules are working for my CRUD app. I have constants defining stuff like max length of each String field. I'm unsure if within tests I should create test data ...
8
votes
5
answers
3k
views
What to call a test that consists of running a program with only logging?
To test that your program deletes the correct files, you run it first in a logging-only mode (by commenting-out delete lines or overriding your delete method to be a logging method).
for file_path in ...
1
vote
1
answer
135
views
Testing edge cases with very large objects
I'm looking for general testing strategies for writing tests to expose bugs that only appear for very large inputs. As an example I will look at the "binary search midpoint bug".
In binary ...
18
votes
11
answers
6k
views
Why is global state hard to test? Doesn't setting the global state at the beginning of each test solve the problem?
According to Why is Global State so Evil?, I know one of the disadvantages of "global state" is that it makes code "harder to test". I do not disagree with this, but what I don't ...
0
votes
0
answers
106
views
Is it really difficult to test these “Service” methods in this Rust Clean Architecture proposal? Is there some other catch I'm not considering?
I reproduced a small example of kerkour's Rust Clean Architecture on the Rust Playground.
The code is just an example and the methods code makes no sense at all.
This architecture leaks DB information ...
0
votes
4
answers
335
views
TDD and code reusability
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 ...
4
votes
8
answers
3k
views
Should I write and commit unit tests for minor changes and bug fixes?
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 ...
0
votes
3
answers
180
views
Design a test framework for validating static files
I have a task to develop a test framework - or a test suite, if it makes more sense - that aims to validate properties over a large set of XML files.
Our codebase is basically like this:
JSON input ...
2
votes
1
answer
784
views
Approach to software testing with docker
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 ...
0
votes
1
answer
263
views
Best practices for setting up a test suite for a python library?
note: here library means a package that is installed from some wheel/egg/tar file. as opposed to a regular package which is just a container of modules basically. package usually is used for both as ...
1
vote
2
answers
358
views
End2End/integration Testing in Java with Selenium - how to get a good test structure - looking for experiences [closed]
At work I am currently tasked to implement End2End/integration Tests for one application using Selenium.
we have an project consisting of a frontend and multiple backends (spring-boot apis). The ...
0
votes
2
answers
1k
views
Should Value Objects be used inside the DTO?
After reading about Value Objects, I think they're pretty cool and should be used, but I am not sure if I am doing it the right way.
Let's assume that I have a simple DTO to create a user, which ...
3
votes
3
answers
1k
views
TDD when removing long lived feature
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 ...
0
votes
3
answers
471
views
Would you test this piece of configuration code? How do I determine which code is worth testing?
We have a piece of code that decorates an interface to transparently add retry logic.
Inversion of Control configuration
service.AddOurRestApiClient()
.AddResilienceHandler("Retry", ...
0
votes
2
answers
121
views
EFCore In Memory repository Unit Test of Encrypted data
I have in project linq repository unit tests.
[Fact]
public async Task Get_FromTreeEntitiesUnsorted_RetunsOrderByDescending()
{
//Arrange
_contextReadonly.Entity.Add(new ...
-1
votes
1
answer
170
views
Will I lose confidence of my code working in mocking dependency injected services? [duplicate]
Let's say that I have a class with a service that is going to be injected at runtime:
class Thing {
private magic: IMagic; // Magically injected service
public doStuff(){
// Do a lot ...
1
vote
2
answers
216
views
How does one reliably test core Linux software (like package managers, UNIX utils, desktop environments, kernel modules, etc.)?
If I'm not mistaken, a major part of testing software is deploying and using it on your platform of choice. For critical system software such as UNIX utils, package managers, desktop environments/...
21
votes
6
answers
7k
views
How would you identify slow queries before reaching production?
Let's say you are running a query on your database.
In development and staging, where the amount of data is small, everything looks good.
Unit and integration tests are also fine and the logic is ...
2
votes
1
answer
115
views
What is the correct way to configure a testing mode on a class?
I have a repository which reads and writes to Firestore, and some tests to make sure data is sent and comes back in the correct way.
In order to test this I added a protected function which returns ...
6
votes
5
answers
8k
views
What to cover with integration tests?
I'm working on adding unit/integration tests to an existing project (Java/Spring Boot) and I've been investigating on how they are "separated" in order to cover the test cases and how to ...
6
votes
1
answer
361
views
What to do when test data takes up most of repo size?
TL;DR: Given a repo with a lot of big fixture tests, when should I look for a solution where the golden files are not part of the repo anymore? Where should they be stored?
The setup
Testing a ...