Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
27 views

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 ...
Brian Kitt's user avatar
0 votes
1 answer
84 views

I have test method using mockito 5 @Test public void test_increaseUserScore_Successful() throws CannotCreateCachedUserException { when(cachedUserRepository .existsById(...
JZARGO's user avatar
  • 19
2 votes
1 answer
69 views

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 ...
Brian Kitt's user avatar
Best practices
1 vote
2 replies
168 views

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 ...
xblz's user avatar
  • 40
-1 votes
0 answers
59 views

I am trying to mock some native node: libraries with Node's native node:test mocking on a CJS TypeScript project. Sometimes I have success when mocking without the node: prefix, other times not. ...
myol's user avatar
  • 10.1k
0 votes
0 answers
59 views

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....
nijj67's user avatar
  • 11
0 votes
1 answer
52 views

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
72 views

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....
vineeth's user avatar
  • 16
0 votes
1 answer
98 views

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 ...
PM Laforest's user avatar
-1 votes
1 answer
39 views

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....
Automatico's user avatar
  • 12.9k
1 vote
1 answer
551 views

private readonly IMapper _mapper; public CreateDepartmentRequestHandlerTests() { var config = new MapperConfiguration(cfg => cfg.AddProfile(new CreateDepartmentProfile())); _mapper = ...
Saidabror's user avatar
1 vote
1 answer
61 views

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 ...
user1688726's user avatar
1 vote
1 answer
126 views

I have a unit test testing service layer of my REST APIs. What I want to test is RegisterAccount in the service layer, which has dependencies on Repository (Database access layer). How do I mock in ...
lizzyy's user avatar
  • 19
2 votes
1 answer
69 views

I have a Thor class that has a getter method defined like this: # Playgrounds CLI skeleton class. # Commands are added from commands folder class CLI < Thor def self.exit_on_failure? true ...
BadIdeaException's user avatar
0 votes
0 answers
27 views

How to Unit Test a Method Using QueryMultipleAsync? I have a method that uses Dapper’s QueryMultipleAsync to retrieve multiple result sets from a database. What is the recommended way to unit test ...
Antesh Pandey's user avatar
0 votes
0 answers
37 views

I'm trying to mock the return set in tableClient.QueryAsycn<TableEntity>(), but it continues to return empty lists. Is there anything glaringly obvious that I'm missing in my unit test. The ...
thinker's user avatar
  • 196
0 votes
1 answer
86 views

I am trying to write a Mockito test class to cover some db interaction. The test case I am writing is supposed to return a stub response when the database call is invoked, but it's throwing an NPE ...
Greg Hazzard's user avatar
1 vote
2 answers
68 views

I'm writing tests for some code that interacts with the filesystem, and I want to assert that it writes the expected data to disk. My problem is that some of the code I want to test includes hardcoded ...
Newbyte's user avatar
  • 3,957
0 votes
0 answers
33 views

I am testing an angular component, which uses a summernote-editor from NgxSummernoteModule. The editor form ist set up by NgxSummernoteDirective using the methode createEditor(): createEditor() { ...
saab's user avatar
  • 139
0 votes
0 answers
165 views

I've been trying to setup Mock Service Worker in my NextJS 15 app (App Router) and faced problems with my client workers. Here are my files with setupWorker/setupServer: @src/shared/api/mocks/server....
Curry's user avatar
  • 33
1 vote
1 answer
148 views

Hope this message finds you well. I'm a little bit lost while using trompeloeil expectations syntax. Let's say I have this: #include <memory> class IA { public: virtual ~IA() = default; ...
anthonyNk's user avatar
1 vote
0 answers
24 views

I'm testing a function `fetch_recent_klines()` that fetches 1m kline data from the Bybit V5 API. It's designed to **halt and return `[]`** if it receives the same chunk of data twice — to detect stale ...
b-Water's user avatar
  • 11
4 votes
1 answer
75 views

My project is huge, I tried to write unitest for one API session import unittest from unittest.mock import patch, MagicMock from alm_commons_utils.mylau.lau_client import lauApiSession class ...
MJoao's user avatar
  • 133
0 votes
1 answer
112 views

TL;DR: I want to test the controller method that uses a service and the service itself that is being called, both in their respective unit test classes but can't do it since mocked bean replaces ...
Palayn's user avatar
  • 91
0 votes
1 answer
98 views

I created an helper class that wraps http calls to an external service using the Http facade: all the methods basically wraps the same http call structure: Http::withHeaders()->post() or get() ...
fudo's user avatar
  • 3,034
0 votes
1 answer
62 views

I followed the GraphQL Tools Mocking guide page to define a mock GQL server like below. import express from 'express'; import { createHandler } from 'graphql-http/lib/use/express'; import { ...
Ruifeng Ma's user avatar
  • 2,847
3 votes
2 answers
121 views

I'm trying to test a PowerShell function that sets the bindings for an IIS website. For the tests I want to create a Site object, that represents an existing website, with a Bindings property. I'm ...
Simon Elms's user avatar
  • 20.3k
4 votes
1 answer
118 views

I have a PowerShell script for setting up a website in IIS. It includes the following function: function Set-IisWebsiteBinding ( [Parameter(Mandatory = $true)] [string]$SiteName, [...
Simon Elms's user avatar
  • 20.3k
0 votes
1 answer
86 views

This is a question about "testing patterns". How to "Don't Mock Things You Dont Own" with JDBC? I tried to Proof Of Concept a JDBC Adapter in the below link, and after trying a ...
djangofan's user avatar
  • 29.9k
1 vote
1 answer
40 views

I'm trying to mock the background_downloader package , specifically this line in my class I'm trying to mock: var status = await fileDownloader.permissions.status(permissionType); I keep getting error ...
Mike6679's user avatar
  • 6,146
0 votes
0 answers
64 views

I am using: junit 4.12 jmockit 1.54 Adopt JDK 21 Test case: @Test(expected = Exception.class) public void testCreateWareshousesNonSupplierDebugModeFalseException(@Mocked Iterator itr, ...
Sun's user avatar
  • 3,594
1 vote
1 answer
108 views

I'm using the delightful Jetty org.eclipse.jetty:jetty-server:12.0.18 for an embedded HTTP server (not using Java EE servlets). Jetty passes an org.eclipse.jetty.server.Request to a custom handler, ...
Garret Wilson's user avatar
1 vote
1 answer
130 views

I have a user space application that opens a Linux device file handle (e.g., /dev/foobar) and then sends ioctls to it. I need to replicate a specific series of answers from the device delivered back ...
Grigory Rechistov's user avatar
0 votes
1 answer
73 views

My app uses Jetpack Compose and includes a WebView. I want to use Mockk (or something like that) in instrumented tests, for example, I want my tests to check that WHEN webView.canGoBack() THEN the ...
18446744073709551615's user avatar
0 votes
1 answer
247 views

I have a streamlit app, for which I'd like to create unit tests. I am unable to mock objects though. I have a foo.py with the following content: import streamlit as st def dialog_func(): result = ...
94621's user avatar
  • 113
0 votes
0 answers
67 views

I'm developing a Node.js application to communicate with a ZKTeco MA300 biometric device over TCP. I'm running a mock server to test the connection, but I'm facing an issue where the connection gets ...
Khaled Guettaf's user avatar
0 votes
0 answers
75 views

In this code, sync_external accepts an array of posts and modifies it by calling a sync method from an external module ExternalService, which is mocked in the test. Assume there's some reason to pass ...
Levvine's user avatar
2 votes
2 answers
180 views

I have some code iterating over files using std::filesystem. I am using dependency injection to mock out the directory_iterator logic, but I have trouble constructing a mocked directory_entry, which ...
Dominik Kaszewski's user avatar
0 votes
0 answers
75 views

I want to write unit-tests for a Typer based CLI, that will run the CLI with different inputs and validate correct argument parsing and input validation. The point isn't to test Typer itself, but ...
Dean Gurvitz's user avatar
  • 1,142
0 votes
0 answers
140 views

For some reason in ViTest mocks are not replacing my real function. I have a main function here const { handler1 } = require(./path/handler1) exports.mainFunction = async (event) => { try { ...
user2569803's user avatar
0 votes
0 answers
63 views

I have a graphQL resolver that looks like this: import { GraphQLSchema } from 'graphql'; import { buildSubgraphSchema } from '@apollo/subgraph'; ... const schema: GraphQLSchema = buildSubgraphSchema(...
Gibran Shah's user avatar
  • 1,119
1 vote
2 answers
56 views

I am new to Go language , can you please let me know why I am getting this error in my code argument 1 expected [uint8 - 99] does not match actual [string - c9d778419a8ce7] Actual code var ...
KshanStag's user avatar
-1 votes
2 answers
36 views

I'm working on a terminal game based on this card game that gets its cards from deckofcardsapi.com. Cards are stored in a struct named Card in a package called card and each Card is stored in a struct ...
wavesinaroom's user avatar
0 votes
2 answers
41 views

I need to verify that exception been thrown or that some logging method been called. Here is my code fun stop() { println("----") CoroutineScope(Dispatchers.IO).launch { try {...
Bob Redity's user avatar
0 votes
1 answer
47 views

I want to mock add_new _costumer() in class NewCoustumer. The filename is**: main.py** import csv import os class NewCoustumer(): def __init__(self,balance_checking = 0.0 , balance_saving = 0.0): ...
aisha bjn's user avatar
0 votes
1 answer
40 views

Mock the sftp-list operation especially the attributes with file name and its path. These attributes are used in a for each loop are not available.
PSAFOL's user avatar
  • 13
2 votes
1 answer
81 views

I am creating a parameterized Mock PyTest to test API behaviors. I am trying to simplify the test code by testing the instance modified behavior, e.g. throw and exception, and the default behavior, i....
PieterV's user avatar
  • 621
0 votes
0 answers
54 views

I have a program that derives last known location from each Location Provider on Android. After using a GPS mock app, some of the providers last known location was marked as mocked - even though the ...
user29928874's user avatar
0 votes
0 answers
57 views

I'm testing a FastAPI service that queries a database using SQLAlchemy's async execution. However, when I mock the database query, execute().scalars().all() returns an empty list instead of the ...
Rohit Kumar's user avatar
0 votes
1 answer
42 views

I have an app that basically ingests documents, stores their embeddings in vector form, then responds to queries that relate to the ingested docs. I have this retrieval.py function which searches ...
Rohit Kumar's user avatar

1
2 3 4 5
320