85,788 questions
-3
votes
0
answers
23
views
How to test Future Publisher with unit tests?
This is my simple class I need to test:
class Example: ObservableObject {
@Published var isError = false
var cancellable: AnyCancellable?
private let failure: Bool
// MARK: - ...
Best practices
0
votes
0
replies
44
views
Testing in MVVM architecture. What to test and how to approach TDD?
I’m currently working on a personal Android project using Kotlin and Android Studio, following a basic MVVM architecture:
─main
│ ├───java
│ │ └───com
│ │ └───example
│ │ └───...
-2
votes
1
answer
44
views
Flutter Golden Screenshot Widget Integration Testing Shadow Mode [closed]
Why is it that my text fails to load in Flutter Widget Integration Testing in Shadow Mode.
I use Golden package to take screenshots, and no matter how long I pump and wait for environment to load, I ...
1
vote
0
answers
51
views
I start integration tests with `dotnet test`. They spawn IIS Express which fails ONLY on CI pipeline if I require code coverage
The test with coverage runs perfectly well locally:
C:\xyz\DevOps\xyz.DependencyInjection [master ≡]> dotnet test -c:Release --no-build -f net9.0 --filter "FullyQualifiedName~Tests....
0
votes
0
answers
60
views
DBT unit tests fail when a struct has too many fields
I am running DBT models on Databricks and I am starting to implement unit tests for them.
I have the following DBT unit test :
unit_tests:
- name: test_my_model
model: my_model
given:
...
1
vote
0
answers
18
views
Ginkgo Receive(BeEquivalentTo()) fails when comparing struct with interface payload
When writing Ginkgo unit tests, I ran into an issue asserting data received from a channel that contains a struct with an interface{} field.
Here's my models.go
type WsBaseMsg struct {
Type ...
2
votes
3
answers
105
views
How to Unit Test Multi-Stage Member Functions in Polymorphic Classes Used with std::variant?
I have three processor classes that share a common interface for polymorphic behavior using std::variant and std::visit. Each processor has a processData() member function that internally consists of ...
Best practices
1
vote
2
replies
164
views
Python - Should VTK be mocked in unit tests?
I am part of a team that is developing a general-purpose, Python-based 3D mesh viewer using the VTK (Python) library.
Read about VTK here: https://docs.vtk.org/en/latest/getting_started
Our Python ...
2
votes
3
answers
150
views
How to create test executables in Makefile in C?
I want to build make test with Makefile, and the test target should generate <file_name>_test executable based on the folder tests/<file_name>.c. All tests/*.c files have a main() function....
1
vote
1
answer
84
views
Mockito spying on a class which contains a static method which calls another static method
I am trying to get a unit test to work using Mockito 5.14.2. The method I am trying to unit test is a static method (m1). Within the same class Myclass1 there is another static method (m2) which ...
4
votes
0
answers
212
views
`dotnet test` is inconsistent when it comes to showing the total number of unit tests at the end
I have a solution with many projects. When I run dotnet test, it selects all my xUnit projects and seems to correctly execute all of them. But at the last line of what dotnet test prints, the number ...
1
vote
1
answer
106
views
How to control test class execution order in JUnit 5 suites?
I'm organizing my tests using JUnit 5's @Suite and @SelectClasses, but need to control the execution sequence of the test classes. According to the documentation, @SelectClasses doesn't guarantee ...
0
votes
2
answers
94
views
How to remove setTimeout in Vitest?
I have a function that allows users to register. After successful registration, the user is redirected to the home page (after 5 seconds). Before being redirected, the user receives a toast ...
0
votes
1
answer
43
views
Mocking Vitest functions for testing Pinia storage
I am struggling adding mocked methods when testing a Pinia store's functionality. There is very little documentation relating to actually testing the stores themselves, as most Pinia's official ...
0
votes
0
answers
55
views
How to mock usager of Laravel scopes for unit testing?
I'm using Laravel 12 along with Pest (using Mockery), and I have this method :
public function destroy(array $ids): array
{
$data= Item::findAllByFieldIn('id', $ids)->get();
// ...
1
vote
2
answers
129
views
Why are ggplot2 font family changes not reflected in vdiffr::expect_doppelganger()?
In creating unit tests for an r package that provides a custom ggplot2 theme, I've noticed that the snapshots created by vdiffr::expect_doppelganger() aren't reflecting font family changes that work ...
0
votes
1
answer
31
views
How to expose kotlin package `import kotlin.test.Test` for a bazel `kt_jvm_test`
I'm trying to compile a very simple kotlin test file based off of the example at https://kotlinlang.org/docs/jvm-test-using-junit.html#create-a-test in order to prove that my setup in bazel is ...
1
vote
0
answers
57
views
System.AccessViolationException occurs when running a C# Godot unit test for Node2D object
I am building a card game using Godot 4.5, with C#. I am trying to unit test a Card object that inherits from Node2D, but when I attempt to run the test, I get the following exception:
Exception has ...
0
votes
0
answers
58
views
Django Testing in microservices with more than 1 db running
I would like to ask about a certain topic that is tough one. Im working in a project that has microservices architecture with more than 1 databases running every time. in django, how can I perform ...
0
votes
0
answers
32
views
Gradle tasks for multiple test types
Our project currently has two types of tests: Tests that communicate with the MySQL test database and tests that don't.
The database tests should be run in sequence as they mutate the same database, ...
0
votes
0
answers
68
views
Swift snapshot testing produces a different image on CI
I'm using point free's swift snapshot testing for capturing images of SwiftUI views.
It works well so far, but when I use SwiftUI's FocusState I get a different output on CI compared to my local ...
1
vote
1
answer
95
views
Moq: how to create a HttpRequest object containing a HttpPostedFile?
I am working with ASP.NET/.NET 4.8 application.
My action method is as follows:
public class TestController: System.Web.Http.ApiController
{
// pseudo code
public async Task<...
1
vote
1
answer
461
views
How to correctly configure the MapperConfiguration?
private readonly IMapper _mapper;
public CreateDepartmentRequestHandlerTests()
{
var config = new MapperConfiguration(cfg => cfg.AddProfile(new CreateDepartmentProfile()));
_mapper = ...
0
votes
1
answer
127
views
A C++ unit test which tests a function which takes a lambda as an argument
I have written a C++ Unit Test which has a design problem.
The test is relatively straightforward. I am testing some kind of "iobuffer" object. There is a function recv which is used to copy ...
1
vote
1
answer
36
views
Unable to complete setting up the CounterFeatureTests class
I am following the guide here in the Getting started document to complete the Testing for your feature module, but I keep getting the following exceptions even if my feature struct conforms to the ...