Questions tagged [testing]
Verifying the behavior of a software system against the expected behavior of that system.
1,470
questions
2
votes
1
answer
82
views
Improvements to test architecture for faster testing
Pandoc is a command-line tool and Haskell library for converting between many different markup and document formats. One of the ways Pandoc's behavior can be customized is via filters -- Pandoc ...
1
vote
1
answer
283
views
Identifying Risks/Gotchas When Using Static
I am intending to come from the perspective of development choices, code reviews, and general testing against defined environments (Development, Test, Production, etc.). I will be using C# as the ...
3
votes
2
answers
373
views
Should tests for frontend test for impossible situations?
I am cruising through a situation where I am my own backend and fronend developer.
Let's say I have a basic backend API with some call /register/{area}.
The {area} piece is dynamic and can change. Now ...
0
votes
2
answers
413
views
When writing tests against the database, should the test to create a resource also retrieve the resource to check the values were correctly inserted?
Where I work, we have some integration tests which spin up a new SQL database instance in Docker, so that we can test the repository logic for write actions as well as read actions. We have a test for ...
0
votes
2
answers
92
views
How to cover by tests HTTP API wrapping library
As mentioned in title, I don't understand how I supposed to cover by tests code which is just wrap http api.
I guess I can write only unit tests, because wrapped service is paid. Integration tests in ...
1
vote
2
answers
228
views
Is there a pattern for unit/integration testing where tests that are higher level are intended to act as "gates" for other more specific tests?
The motivating concept here is that the fewer tests you have, the faster your test suite runs. This kinda feels like I'm basically describing smoke tests, but I think smoke tests and other tests are ...
1
vote
3
answers
1k
views
Should simple helper functions be used to consolidate function calls in test code?
We have test code like:
clickElement(a);
clickElement(b);
clickElement(c);
that's repeated in many places, where clickElement is called 1 to 5 times in a row.
Should we make a helper function to ...
-1
votes
1
answer
66
views
Properly testing UI presenters without duplicating tests of subcomponents
I am writing the embedded firmware for an effect pedal. The pedal's ui consists of a few knobs
a few buttons and a few leds and it consists of various control modes each corresponding to a seperate ...
4
votes
2
answers
3k
views
What's the best way to get GitLab Docker runners and Python tox to work together?
I'm trying to get a better understanding of how tox and GitLab CI (with docker runners) would work together, as they seem to have a bit of overlap in what each does. I think I may be missing something ...
4
votes
1
answer
197
views
Do kotlin libraries with inline APIs encourage high coupling and discourage unit testing?
As an example, let's assume our application needs some way to communicate with other systems using HTTP.
interface HttpClient {
fun <T> get(url: String, returnType: Class<T>): T
fun ...
1
vote
2
answers
319
views
Can a build system be used effectively as a unit test runner?
The way of running automated tests (specifically, a large number of small, «atomic» unit and regression checks) that I am used to is to maintain a monolithic executable built on top of a test ...
0
votes
1
answer
1k
views
Java: Splitting a large unit test class
The project (Java/Spring) I currently work on has a rather large unit-test class for one of its services : more than 1000 lines, several Nested class (one per big functionality), some tests without a ...
0
votes
2
answers
250
views
Unit testing multiple features in one test
I'm writing a small utility class to create an abstraction for addEventListener (JavaScript/DOM)
Let's say I have to test for these features:
Single event target with a single event
Multiple events
...
58
votes
11
answers
15k
views
If two individual branches pass unit tests, once they're merged, is the result also guaranteed to pass unit tests?
Suppose we have two branches A and B which have been forked from master.
Both branches A and B make some changes and implement some unit tests. They pass all current and new tests, then are merged ...
6
votes
1
answer
13k
views
Should I mock ObjectMapper in my unit tests?
I have different services in a spring application that have a dependency on Jackson ObjectMapper, the unit tests rely on @InjectMocks to inject all the various dependencies to the class that is under ...
0
votes
1
answer
138
views
Draw Data Flow Graph with Constructor and Functions
I am new to software testing and would like to know whether it's appropriate to draw a data flow graph that flows from initiation of variables to constructor and method.
Is there something wrong with ...
1
vote
2
answers
1k
views
C++ Organizing classes for easy unit testing (but with some restrictions)
Mild pickle. I have a project which has components that are difficult to test/mock. It might look something like this:
class Contenxt;
class Server : public SomeOtherClass
{
public:
ServerPlugin(...
1
vote
1
answer
108
views
An effective way of finding regressions
There is a rather large data flow engine - more than 2000 different flow definitions of "what to do with inbound data". The engine deals with various data formats (flat-file, CSV, JSON, XML, ...
1
vote
2
answers
829
views
What is the correct way to unit test methods that mix dependencies and business logic?
I'm struggling to come to a consensus on the right approach that can be used somewhat consistently to balance integration and unit testing.
Take the following method, that is extremely common to find ...
2
votes
2
answers
1k
views
Unit Testing Controllers without Mocks
I've done a lot of test writing using Mocks, and so I've learned that it makes refactoring difficult due to implementation coupling inherent with Mocks. I've done a lot of reading on the topic tonight,...
-1
votes
1
answer
608
views
How to create input data for unit tests for an API client?
I am building the initial set of unit tests for my team's legacy API client system. We have been writing integration tests, but have no unit tests.
It's a Sinatra server that accepts requests from our ...
0
votes
2
answers
3k
views
In unit testing should I check if a method is being called or just check the result?
Suppose I have similar function:
Helper2 helper2;
public void myFunc(Helper helper)
{
if (....)
helper.mySecondFunc();
else
helper2.myThirdFunc();
}
In my unit test should I ...
0
votes
2
answers
4k
views
Unit testing private methods
preface: I know this topic has been asked about a lot on here in the past. Hopefully I will make it clear that I've read a fair amount of the questions/answers on the topic, and other literature, too. ...
3
votes
1
answer
1k
views
How to test channel pipelines in Go
I use the "channel pipeline" pattern quite a lot in Go, which looks something like this:
// getSomeNums spits out ints onto a channel. Temperatures, pressures, doesn't matter
func ...
27
votes
8
answers
5k
views
Does software which implements scientific models require unit tests?
I work in a field where lots of code is written, but hardly ever tested. This is because we are foremost scientists who try to solve problems with code. The few coding courses we had, focused on the ...
0
votes
3
answers
580
views
How to arrange expected result model for test in a cleaner,readable way when the model contains many properties
In one of my projects I saw wrapping the expected results as a static variable in non static class. The reason for doing so is to make the code more readable, so that the massive expected result model ...
3
votes
1
answer
406
views
Store OAuth 2.0 tokens for use in testing and CI/CD
I have a web application where users must authenticate with a 3rd-party OAuth 2.0 service in order to do what they need to do in the app. On initial registration/login, they will connect with the ...
1
vote
2
answers
160
views
What do I call "unit tests" that are specifically developed during tinkering?
When developing a new section of code functionality with modules I'm not familiar, I'll often create a set of unit tests that are for "tinkering" and interactively analyzing the results in ...
-3
votes
1
answer
166
views
REST API Testing best strategy
I'm currently developing a personal project using Django REST + React and as it grows more complex, I want to add unit testing to ensure that changes don't affect previous functionality. However, I'm ...
0
votes
2
answers
603
views
Who should describe the testing procedure of a bug?
I used to work for a software development company, and there they had following way of solving bugs and the according testing:
The bug ticket is analysed by the developer.
The developer solves the ...
-2
votes
2
answers
225
views
Testable architecture of micro-services
Into:
There are mutliple ways to test code: unit tests /e2e / manual testing /..
I'm developing a project that it's implementation details changes very quickly (and sometimes the core functions as ...
50
votes
8
answers
13k
views
How do I really write tests without mocking/stubbing?
I have been using TDD when developing some of my side projects and have been loving it.
The issue, however, is that stubbing classes for unit tests is a pain and makes you afraid of refactoring.
I ...
1
vote
5
answers
254
views
Hypothetically if every scenario were covered by an end-to-end tests, would unit tests still have any value?
Note: I'm asking about the strategy behind unit / integration / end-to-end tests, not about classifying tests as one or the other.
More so in the past than present, it was expensive to write and run ...
4
votes
1
answer
4k
views
Clean Architecture use case testing
Use case interactors in the Clean Architecture consists of the application specific business rules.
Interactors uses the Data Access Interface to fetch the required data from the data access layer.
...
1
vote
2
answers
2k
views
How to respond to a customer when their bug can't be reproduced
A customer has reported a bug that neither them nor us have been able to reproduce. This is the only report of this bug happening so far.
We've spent a lot of time trying to replicate the issue (...
1
vote
1
answer
102
views
What is better way to track mistakes in error-prone part of a feature?
That is quite specific circumstances I've come across, and I somewhat struggle to find proper way how to approach this.
I'm given a class written in swift-language, which has a control property, like ...
3
votes
4
answers
1k
views
How do I deal with the fact that I am forced to make helper functions public for testing purposes?
I've encountered several scenarios that require me to mock certain helper methods because they call outside resources. As a result, I'm forced to convert all my helper methods from private into public....
-5
votes
1
answer
95
views
Should code be refactored to be more unit testable or should a framework like PowerMock be used?
Assume there's some code that's already in production that needs some unit testing. Generally speaking, would you want to refactor this code that's already in production by adding things like adding ...
3
votes
3
answers
2k
views
Is it necessary to run tests in all environments?
In our project, we have DEV, STG and PRD environments that are configured to mirror each other (especially STG and PRD). We have unit tests that we run on DEV and, if they pass, are moved to STG when ...
0
votes
6
answers
398
views
TDD - Make the test work quickly, committing whatever sins necessary in process
Red-Green-Refactor
Green stage says, Make the test work quickly, committing whatever sins necessary in process
Having an idea of writing a test & make it work quickly, does not look intuitive ...
-1
votes
1
answer
544
views
Is the self-shunt pattern the same as stubbing in TDD?
I am reading the book TDD by Example and one of the patterns demonstrated was the self-shunt pattern.
Basically, if I am not mistaken, if I have a test like this:
test("list of users should receive ...
3
votes
3
answers
360
views
Should you define an equality test solely for testing?
Assume you have a class C. C defines a public method (member function) C::m1.
Calling c.m1() (c is an instance of C) can either
Return after mutating the object c it was called on.
Throw an ...
0
votes
5
answers
1k
views
How to reduce the merge-redundancy due to testing in our Git workflow?
We have are a small team of 6 people working with Scrum and Git.
We are developing a quite complex webapplication with the ZK Framework. It uses Java and a MySQL database.
We have adapted the "Git ...
-4
votes
1
answer
1k
views
Is it possible to derive a test suite to achieve 100% path coverage? [closed]
Here is an example with the function:
Examining this I believe that it is possible to achieve 100% path coverage.
My understanding of path coverage is that you need to design test cases such that ...
0
votes
3
answers
316
views
How to control time with API testing?
I'm trying to test an API (see API testing).
Some operations depend on time.
Here are some examples:
A post may only be edited within the first 5 minutes
You may not try to login more than 10 times ...
4
votes
2
answers
820
views
Should API tests depend on each other?
I have an API I wrote that I want to test at the API level.
Given that I'm testing from an external point of view, how can I manage data sets for each tests?
The simplest solution I could come up ...
3
votes
1
answer
303
views
What do you unit test in your angular applications?
I am currently working in a team, which, when I joined them did not do any sort of unit or integration testing.
Over the last 2 years I have bit by bit pushed dotnet unit testing to a point where it ...
6
votes
2
answers
750
views
Is it a bad practice for a unit test to "trust" the other?
Assume I have the following two functions:
function storeObject(object) {
// Connect to database
// Prepare query
// Execute query
}
function retrieveObjectWith(id) {
// Connect to ...
-2
votes
1
answer
65
views
Testing function that return objects
My web app is built around classes that I call widgets. Their goal is to be reusable and modular, to suit different scenarios. For example, I have a widget called BreadcrumbWidget which has two ...
1
vote
1
answer
397
views
Persistence layer in the automated testing of an API
The automated tests of an API should be stable and simple.
When writing automated tests for an API, we often have to check that the data created with a program implementing this API is persistent. If ...