Category "unit-testing"

Dotnet Unit tests failed once but works on the second run

I'm facing a problem when I want to run unit test on my c# project. I have the same behaviour using Visual Studio or command line. Here's my process: Ensure tha

FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app) - when using sinon

I have a NodeJS application and I'm trying to write some tests. Currently, I'm trying to stub Firebase. Current code: sinon.stub(firebase, 'initializeApp'); con

Testing in pandas library: Why is function style chosen over class based testing?

Why is functional style testing facilitating testing compared to class based testing? Is this just additional library specific functionality or are there any ge

Mock gRPC Response Stream for unit testing - C#

I have a function that calls a gRPC endpoint, converts the objects into POCO objects and returns them as a list. public class ActionPlanConnectionsService : ICo

Angular Jasmine testing - substring remove from number

I have some difficulties in unit testing a function. I'm new in these things and I don't know what I can do. I have to those 2 if. Any advice? Thank you.

py.test: error: unrecognized arguments: --cov-report --cov=

I am running this test case command below py.test --cov-report term-missing --cov=pipelines/core/comp/plugins/abc/ --noconftest pipelines/core/comp/test/plugins

Angular testing async function generate error - 1 periodic timer(s) still in the queue

I'm trying to test that two async functions. The problem is that one of the functions is called every 10 seconds automatically. I tried to use tick() or flush()

How to test specific hSpec property using `--match` and cabal

I have a bunch of test modules and I can run a specific one using cabal test. cabal test Module.Name.Here The module contains many tests and one of them fails

How to assign new value to a ModelForm field which form edits user data, to test if the data will be edited Django test TestCase

I'm testing Django forms handling and trying to test a ModelForm, which form edits the user's data. I tried to write the test in several ways, but each one thro

Laravel Json test with Bearer authentication

I'm writing a simple test to assert if an api endpoint response returns with 200 status. My api got Bearer authentication through sanctum middleware. My test fu

Testing Reactive Forms in Angular with Karma

I am testing a function that has a reference to a form in it (this.form), so when I try to test it I am wondering how I can mock that form so the function has a

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