Category "unit-testing"

Mockito mockStatic cannot resolve symbol

I'm using Spring Boot and in a unit test, I'm trying to mock the Files.delete(myFile.toPath()) method. To do so I'm trying to use the Mockito.mockStatic() metho

Is it possible to use Visual Studio 2022 Test Explorer to run C unit test?

I would like to run ansi C unit tests in VS by mean of Test Explorer (not only with Console). I saw that it's possible for C++ projects (https://docs.microsoft.

How to reset a method mock in Spock?

I had a mocked bean in a configuration: @Profile('test') @Configuration class TestSecurityConfig { private final mockFactory = new DetachedMockFactory() @Pr

how to do advanced unit tests python

I am pretty new at unit tests and have seen fairly basic examples of mocks and doing asserts that test the return value of a function. I have a fairly advanced

How to test api is triggered or not in jest with testing react library

Login.js import {useSelector, useDispatch } from 'react-redux'; import Header from './Header'; import {submitForm, handleChange} from '../actions/authenticati

How to create unit test for a Python Telegram Bot

I've built this Telegram Bot in Python, with python-telegram-bot. It's not so complex, but I want to do some regression tests to check if everything works fine

Kotlin Android Studio: org.junit.ComparisonFailure with NBSP

I have this code @Test fun price_twelve_cupcakes() { val viewModel = OrderViewModel() viewModel.setQuantity(12) viewModel.price.observeForever {}

How to test a singleton generic template to be thread safe?

How do I make Singleton generic template, and how can I test it? Right now I am interested in seeing with my own eyes that 2 threads that invoke get_instance()

What I am doing wrong when testing this method?

I am trying to test a method within a service that performs an http post. I have mock the service in my spec.ts and all seems correct for me, but the boolean va

Unit test with jest involving a class instance declared within a vue method

I have this logic for temporarily reading and displaying a profile image: setTempProfileImage(file) { if (file) { let reader = new FileReader()

Need do write unit tests with jest for react app, that uses okta, but getting warning

import { SecureRoute, Security, LoginCallback } from '@okta/okta-react'; import React, { useMemo } from 'react'; import { Route, Switch } from 'react-router-dom

Flutter Widget test cannot emulate different screen size properly

Before deploying my Flutter app, I wanted to test it on multiple screen sizes to check if there is any Renderflex overflow for smaller screens. But I when first

Jest Call retries were exceeded

I have error in the following below test. My node version is : v12.10.0. is there any alternative of setTimeout? test('demo code', async () => {

What is the best way to mock disconnect within SQLAlchemy

I write tests for CRUD application and i want to be sure that its behaviour is correct during different scenarios when connection to DB permanently or temporari

Unit (real unit test) of test laravel relationship

Background Framework: laravel 9.x PHP 8.0 Continuous integration (Travis CI etc) I am working on a project that is legally very sensitive, so testing is vital.

(Apollo client v3) useLazyQuery custom hook testing

I was struggling with a test issue for my custom useLazyQuery hook. My first test is passing but the second one is failing. What am doing wrong for the second t

How can I use jest to spyOn an internal function?

2 questions in 1 here. Why do I get an error message for my jest.spyOn saying that createMappingsDirectory is not a function? Secondly, I think where I’ve

How to mock axios.create([config]) function to return its instance methods instead of overriding them with mock?

I'm trying to mock axios.create() because I'm using its instance across the app and obviously need all of its implementation which is destroyed by the mock, thu

LNK2005 linkage error when running c++ unit test

I am relatively new to c++ and I am not sure how I can resolve this error. I have a namespace QueryUtils which I am including it into another class QuerySyntaxP

PyCharm: individually working tests, not finding a file when run in group

In my Python project, I have a set of unittests, that load some data from files in a data sub-directory. In PyCharm (Community 2019.3), running each of them in