Questions tagged [testing]
Verifying the behavior of a software system against the expected behavior of that system.
1,419
questions
-1
votes
0
answers
25
views
Software testing single node B-TREE [closed]
I am trying to solve this question about testing in software systems, can anybody help? Thanks.:
And this is control flow graph for B-TREE:
B-Tree algorithm of flow graph:
-1
votes
0
answers
36
views
How to correctly test a JSON parser with multiple methods
I wrote a parser that parse XML files of some format (EDIFACT) using PHP, to do this, I converted the XML to JSON then to php array (a Laravel collection more precisely) and then I started parsing ...
-2
votes
0
answers
30
views
Test web app in development with playwright on BitBucket CI
I'm currently trying to use Playwright and jest-image-snapshot to do visual regression testing on my React front-end. I'm currently using Bitbucket Pipelines for my CI. I'm trying to run both my front ...
0
votes
1
answer
112
views
Mock a bean with 10 methods when I only use one?
I face some situations similar to the following simplified one:
@Component class ServiceOne {
@Autowired ServiceTwo two;
void act() {
...
two.a();
...
}
}
@...
0
votes
1
answer
36
views
Should Functional Testing of an application be part of an application project/build or a seperate project ran independetly
Let's take an application that provides a REST API. As part of the build process, both unit tests and integration tests are run against it.
At some point we want to spin this application up properly, ...
3
votes
3
answers
230
views
In testing is making asserts in cleanup bad?
As a learning excercise, I decided to take a hand on Test Driven Development.
Now I decided that there is a test I want to make; check if database connection doesn't leave any unsaved changes.
The two ...
3
votes
2
answers
361
views
Testing interaction with proprietary software without a license
First a bit of context:
My company develops a software and middlewares to make our software interacts with other software.
One of a client has a proprietary software we should interact with, he gave ...
0
votes
1
answer
58
views
Manual Testing with OR condition/multiple valid entry points
I am trying to figure out the best practice for manual testing where there are multiple valid routes to reach a step in the test.
For example, a test for changing a password could be:-
Test 1
User ...
-3
votes
0
answers
57
views
How to refactor legacy c# code without unit tests? [duplicate]
Recentely I'm working on an legacy project that
Has not any unit tests.
Used Entity Framework as data access technology
The DbCobtext used directly in the business codes The
Project is big(writing ...
0
votes
2
answers
178
views
Is it worth testing simple details? [closed]
In front-end projects(made in frameworks like Angular or React), when we correctly encapsulate complex functionalities, the components that really have some relation to the business logic normally ...
0
votes
1
answer
43
views
How to load consistent test data into multiple applications (which communicate by message streams)?
I have a system landscape consisting of multiple applications.
Each application provides REST interfaces to communicate with the outside world.
Each application has its own data storage (some kind of ...
1
vote
3
answers
126
views
Should test resource files be stored inside the Java class source directories?
In a TDD (Test-Driven Development)-based Java project built by maven, lots of classes needs to be tested with text-based input files such as .csv. At the beginning, I put them into the src/test/...
0
votes
3
answers
90
views
Improve CI process by testing against docker image and fail docker build if test fails
Our CI process goes as this cycle (I think it is quite normal), unit test => build docker image => run function test against the image => if test fails remove the failed docker image, figure ...
0
votes
3
answers
87
views
Identify Enhancements early as a QA
I am having a problem currently where product managers are raising improvements as bugs. Also, they expect us testers to catch them early. Our company doesn't have any requirement document and as QA ...
3
votes
1
answer
187
views
Should I unit test "trivial" functions that are thing wrappers around the Pandas API?
I'm working on a codebase with very little testing. The code is 90% an ETL pipeline with functions like
def sort_data(df: pd.DataFrame, column: str = 'date') -> pd.DataFrame:
return df....
2
votes
4
answers
375
views
How can unit testing be employed to discourage developers from changing structurally-critical code?
Imagine a system for loan applications where loans can be in one of three states: PENDING, APPROVED, REJECTED.
Over time, people create code, UIs, internal reports, etc. that assume there are only 3 ...
-1
votes
1
answer
159
views
Are simple lambdas testable? [duplicate]
I have a simple lambda that is basically x => "Error: "+x+".".
I was just wondering if this was worth a test. It's really just a one-liner, so there's not much that can go wrong....
-3
votes
1
answer
76
views
Proper Way to Start Unit Testing a Web API [closed]
I need to start testing a Web API, for now I'm going to start with unit tests and I can't figure out the right way to do it. Here is what I have in mind doing:
The API consists on a list of endpoints ...
-1
votes
1
answer
106
views
How to write tests for a class that talks to a server without revealing connection implementation
I'm writing a class that acts as the interface to a server. The interface exposes a way to send messages to the server and pass messages back to the client through a callback. Implementations should ...
0
votes
2
answers
57
views
How to reset state of exernal services when running Acceptance tests
What are the generic patterns and best practices for resetting state of a database, storage, external service, etc, in Acceptance Tests?
I'm struggling with spaghetti, living in acceptance tests. It ...
0
votes
1
answer
202
views
Mocking clock in C++ unit test
I'm working on a project that does things depend on how much time has elapsed. Specifically for testing purposes, I need to call a method twice a second. The basic idea of the test is something like ...
27
votes
5
answers
6k
views
Dry running a function
I have a function with a sensitive operation:
function doSomeThingSensitive() {
customers = getAllCustomers()
for each customer in customers
if customer is from Europe
Give ...
2
votes
3
answers
289
views
Still don't understand when to mock and when not to
I've been trying to understand when to mock and when not to mock, however I'm not able to come up with a consistent guideline and I'm hoping to get some input on the subject. Let's look at the ...
0
votes
2
answers
118
views
On hanging Desktop-applications
I am filled with questions pertaining to the situations where a desktop-application hangs, possibly for minutes.
I've got this complicated game-engine written in c++. Several times during development, ...
0
votes
0
answers
60
views
What is the correct approach to test CDI classes in service layer?
My app has a service layer which is composed by CDI @ApplicationScoped beans. This is a class extracted from my project:
@ApplicationScoped
public class PostService {
@Inject private ...
0
votes
1
answer
172
views
Should i specify that my methods "throws ConstraintViolationException" if the exception is actually thrown by a CDI interceptor?
Here is a sample method:
@ApplicationScoped
public class MyClass{
public void getUser(@Min(1) int id){
//get User logic
}
}
I'm in a CDI environment with @ValidateOnExecution(type = ...
0
votes
3
answers
183
views
Should test cases show desired behavior or actual/current behavior, or can they do both?
Let's say I want to add tests to a software that has some flaws/bugs.
I want to add the tests before I fix the bugs. And I want to actually merge them in the main branch, not just have them in a ...
-1
votes
2
answers
105
views
Unit testing inside the main project [closed]
Usually, unit tests are built in a separate project/executable.
Ideally, components under tests should have a small number of mockable dependencies, allowing us to do this, among other benefits.
But ...
0
votes
11
answers
819
views
Testing : Why is it necessary?
Hello I will try to explain what is my actual understanding of tests and why I have problems to grasp it's utility.
Even if I try my hardest to understand the concept of TTD, unit test, integration ...
-2
votes
2
answers
146
views
Best practices around writing testable extension methods
I’m currently working in C# and I’d like to write and extension method against a type. There is a small amount of repeated logic between classes surrounding JSON deserialization, using the ...
-2
votes
2
answers
78
views
Should application state be tested when testing Api?
I am trying to adpot a TDD process. I am a bit confused when it comes to testing an Api. I know for sure that the status and the response should be tested.
But I am thinking if whether or not I should ...
0
votes
1
answer
55
views
Isolated Integration Tests in Layered Software Architecture Pattern
Let's say we have a simple application that uses a popular approach as Controller -> Service -> Repository pattern under a framework.
We would like to write integration tests and start from ...
0
votes
1
answer
87
views
Refactoring business logic out to private methods and testing
I am currently working on a project where there is a class ContactMonitoringJob a Quartz IJob class which in brief keeps pulling from a database and checks if any new changes have been introduced ...
0
votes
1
answer
109
views
How to test adapter code?
I write a software which trades with crypto currency via big exchanges. Using the clean architecture approach I have defined some core entities, some business cases and then created an outer ring of ...
0
votes
3
answers
243
views
Should I unit test functions internally used by API I expose?
I'm writing a CRUD app in Python that exposes web API. At first I wrote functions for communicating with DB and wrote tests for these functions.
def crud():
# do something with db
def test_crud():
...
0
votes
0
answers
90
views
Trade-off between usability and clean design
I have designed our in-house hardware testing framework. My goal is to ultimately release the framework into the public domain. Early on, my foremost design criterion was to provide a powerful yet ...
1
vote
1
answer
195
views
Should I check floating point values in a unit test?
We have unit tests that are running some underlying model. We provide it with some test input, and receive some outputs + floating point scores. What's a good practice from a unit-testing standpoint? ...
3
votes
1
answer
81
views
Structuring user story tests with variations
I'm writing the sort of tests which go through a whole user scenario e.g.
User clicks "edit profile"
User edits their name
etc.
However, I find myself needing often needing to test small ...
1
vote
1
answer
121
views
How to test functionality that requires a certain internal state?
I'm struggling to test functionality in a class where the class has to be in a certain state for the functionality to work, but the class cannot be put directly into a given state by design, to ...
1
vote
2
answers
67
views
Is the use of third party software and network requests the motivation for integration testing?
I'm wondering if the use of third party software and/or network requests is the motivation for integration testing? For the sake of keeping the code examples minimal, I'll define a unit test as ...
0
votes
0
answers
32
views
Test strategy for liquibase changes
I am part of a team that works on a SpringBoot application and we use liquibase for maintaining our database changes.
Config data that has to be added/removed/modified goes as part of a change-set.
...
3
votes
3
answers
349
views
What to call tests that check that output has not changed?
This is a question about terminology, not about method.
Our application consists of physical simulations. Results have been validated in various ways, but we have no oracle that guarantees correctness....
3
votes
1
answer
149
views
Is it necessarily a code smell to programmatically create expectation models for test cases?
I'm responsible for staging some tests, against some members, namely against the rates that are due for them. After talking about it with my peers, I see the members are a function of three other ...
0
votes
3
answers
391
views
Should I test an all mocked method?
I have a similaire scenario:
int retrievePrice(string productName) {
string id = restApi.get("productid", productName);
return restApi.get("productprice", id);
}
The restApi ...
1
vote
2
answers
147
views
How to avoid unit test duplication in wrapper classes?
Assuming I’ve a class with three methods, startCollection, add, endCollection.
One test case is: if start was not called, add should return an error.
I’ve mocked the persistency storing the state with ...
0
votes
2
answers
125
views
Platform that converts Documentation into Unit/Integration Tests? [closed]
I've seen many SO questions around auto-generating unit tests, or documenting unit tests, but I'd like to go the reverse direction. What I'd REALLY like is to have folks (devs, tech writers, etc) ...
5
votes
3
answers
274
views
Where to specify mock behavior in Given-When-then syntax?
I am unsure where/how to specify the behavior of a mock in a test scenario when using the Given-When-Then syntax.
It seems to me both Given and When could be correct.
Consider the following example:
...
2
votes
1
answer
211
views
Setting up tests and a continuous integration pipeline in a polyrepo environment
In the past I've mainly worked with monorepos, specifically a Vue.js app that was served by a rails backend.
Setting up E2E/integration tests in the CI was simple, because all the required parts were ...
0
votes
1
answer
84
views
ASPICE assessment: detail of test logs
The "VDA Automotive SPICE Guidelines" (excerpts: https://vda-qmc.de/fileadmin/redakteur/Software/Automotive_SPICE/Veroeffentlichungen/VDA_Guideline_Rules_and_Recommendations_2017.xlsx) tells ...
-1
votes
1
answer
75
views
How to black-box test transaction atomicity?
Suppose we need to ensure that a sequence of database operations - currently implemented as A followed by B followed by C - executes either all together, or not at all. We can achieve this using a ...