15,969 questions
-3
votes
1
answer
57
views
Postman MockServer can't respond
I created a mock server in Postman, and I link it with my collection.
I clicked "Add Example" to my request and I created a response.
But when I make that call, in response I get a 404 with:
...
1
vote
1
answer
86
views
Mock not called by subprocess
An instance of class A starts a sub-process that calls a method of an instance of class B. It works as expected in real-life, but unit tests fail because the mock object replacing the object of class ...
1
vote
2
answers
93
views
FastAPI: Not able to use AsyncMock in "async with connection.execute()" context for aiosqlite (async sqlite3 library) while testing the endpoint
I am using Python 3.13.2
I have async with connection.execute(query) as cursor: block in my endpoint, which I want to mock (connection is an object generated by await aiosqlite.connection(':memory:').
...
0
votes
1
answer
50
views
FastAPI: Not able to use AsyncMock to fetch mock rows from aiosqlite (async sqlite3 library) while testing the endpoint
I am using Python 3.13.2
I am trying a sample use case of using AsyncMock to simulate fetching of mock rows from DB to test my endpoint (using pytest-asyncio).
I have also included a non-mock endpoint ...
-1
votes
0
answers
46
views
Angular 20 w Story 10 mocking a navigation click
I have an Angular 20 app, running Storybook 10. My component works perfectly, however, I'm trying to set up Storybook to mock a navigation link. I just can't seem to get it to work.
This is my ...
0
votes
1
answer
97
views
Mockito ArgumentMatchers.any(Class) for varargs parameter does not match
I have test method using mockito 5
@Test
public void test_increaseUserScore_Successful() throws CannotCreateCachedUserException {
when(cachedUserRepository
.existsById(...
2
votes
1
answer
75
views
Angular Karma getting Module not found: Error: Can't resolve
I have a large Angular App that works fine. (v20 if it matters)
I recently added a new service to my App.Component, and now I'm getting the following error. ONLY in Karma, the service works as ...
Best practices
1
vote
2
replies
170
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 ...
0
votes
1
answer
110
views
How to mock multipart/form-data with pytest?
I have a POST endpoint with fastapi that goes a little like this. This takes in an excel file and turns it into a pandas dataframe.
@router.post(
"/endpoint/upload_excel",
status_code=status....
0
votes
1
answer
53
views
I can only run my backend tests locally because all the instances of the mocked environment are created and into the actual db because of celery
I want to create tests but every time I run a test it triggers celery and celery creates instances into my local db. that means that if I run those tests in the prod or dev servers, then it will ...
0
votes
0
answers
74
views
Junit test case failing
I have a springboot maven project in which I have a very simple class which has a static method which takes in a http client, some configs and an object mapper
This class is under package com.cs....
0
votes
1
answer
102
views
Mocking nested functions in a Hardware Abstraction Layer
I am using ceedling to unit test a file called adc.c that depends on functions defined in HAL file stm32h7xx_hal_adc_ex.c. The documentation says that I should only include the top level header file ...
-1
votes
1
answer
44
views
Python unittest.mock fails when using pydantic.BaseModel
I have come across this problem when making my unit tests.
from unittest.mock import AsyncMock, patch
import pydantic
# class Parent(): # Using non-pydantic class works
class Parent(pydantic....
2
votes
1
answer
857
views
How to correctly configure the MapperConfiguration?
private readonly IMapper _mapper;
public CreateDepartmentRequestHandlerTests()
{
var config = new MapperConfiguration(cfg => cfg.AddProfile(new CreateDepartmentProfile()));
_mapper = ...
1
vote
1
answer
65
views
Mock patch sys.stdout to StringIO as a decorator
I am trying to mock.patch sys.stdout to StringIO as a decorator to record the output for testing.
As a 'with' statement it works this way:
with mock.patch('sys.stdout', new_callable = StringIO) as ...