85,787 questions
-3
votes
0
answers
38
views
How to avoid breaking all tests whenever I add new dependencies?
I keep running into an annoying issue where my integration tests break every time I add a new dependency to one of my services.
For example, let’s say I have three services: A, B, and C.
class ...
0
votes
1
answer
47
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 ...
3
votes
2
answers
129
views
Verify object value returns false when the value is changed in code using MOQ
I am creating a test to verify an object is passed to a method then verifying that the params match to the method in the call I am testing. The problem I am having that the object I am verifying ...
0
votes
1
answer
29
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 ...
1
vote
0
answers
67
views
How do I approach unit testing for interrupts on STM32F407? [closed]
I’m currently working on an STM32F407 project. I’m trying to understand how to approach unit testing for interrupt-driven code.
From what I know, most unit tests run in a host environment (not on the ...
2
votes
2
answers
87
views
Are these unit tests using Moq testing anything?
I am attempting to test a repository method using a moq with a setup in the test. As far as I can tell, this is not testing the method but only testing the test.
Here is an abbreviated version of the ...
0
votes
0
answers
43
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
1
answer
48
views
Poxing a mocked generic method with Moq
I provide a generic provider for Json serialization:
public interface IJsonSerializerProvider
{
T? Deserialize<T>(string value);
string Serialize(object? obj);
object? ...
1
vote
2
answers
126
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 ...
1
vote
1
answer
54
views
How to directly test ActionController::RoutingError for an invalid path in Ruby-on-Rails-7.1?
In Rails Controller tests of an invalid route, this used to work before Rails-7.1 (in Minitest):
assert_raises(ActionController::RoutingError){ get "/non_existent" }
In Rails-7.1 (or later),...
0
votes
1
answer
28
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
votes
1
answer
29
views
Accessing calls/args in a global mock with spied functions
In a large Vue 3 app, we have some helper modules that are imported into various components. One of these helpers returns the root node, which itself contains many other methods.
In the app calls to ...
1
vote
0
answers
44
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 ...
-1
votes
2
answers
80
views
How to create test cases in Polygon for Python program with random values?
I have a beginner Python program that generates random output and does not take any input. For example, it simulates rolling a dice 5 times and prints the results, their sum, and average:
import ...
0
votes
0
answers
48
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 ...