Category "unit-testing"

How to test system that requires Time resource?

I want to write tests for system that moves entities and detects collisions, system uses Res<Time> to ensure that entities move with constant speed. I was

Vue Pinia function is undefined in onMounted when unit test is ran

I have a component and a Pinia store which contains a state and some actions. The code works perfectly fine in browser and in E2E (cypress) tests, but fail on u

Python: How to use mock or patch to check that a method inside another method has run?

I've read through a whole bunch of answers, but still don't understand where I need to mock and/or which class/module to patch and keep getting module does not

Cannot find module 'react-dom/client' from 'node_modules/@testing-library/react/dist/pure.js'

hope someone could help me here. while running npm test got following mistake Cannot find module 'react-dom/client' from 'node_modules/@testing-library/react/di

override injection token in unit test

I have a simple service with an Injection token that is used to provide some kind of configuration for the service. It's all working as expected. Although I was

Unit testing callable firebase function with App Check enabled

I am trying to unit test my firebase callable cloud function according to the examples provided. See Firebase Example. It boils down to something like this cons

How do I mock AddAsync?

I'm writing unit test. For testing the method below, public async Task<Guid> CreateWebJobStatus(string blobId, Guid loggedInUserId, string loggedInUserE

How to extract Left or Right easily from Either type in Dart (Dartz)

I am looking to extract a value easily from a method that return a type Either<Exception, Object>. I am doing some tests but unable to test easily the r

AWS Amplify Cognito Angular Unit testing

I am new to unit testing and just decided to add test coverage for my existing app. I am struggling in writing the unit test cases for the given service . I hav

ngx-translate Problems with unit testing

0 I'm using ngx-translate library and having some issues with unit testing because it wont find certain provides. The issue its that even tho i place a provider

How to get the TestCategory with in the CustomTestMethod attribute

I have create the Custom Test Method attribute. public class CustomTestMethodAttribute : TestMethodAttribute { public CareSourceTestMethodAttribute(string c

How to use jest to mock out a private variable

I am trying to write a unit test for a function like this: export class newClass { private service: ServiceToMock; constructor () { this.service =

Phpunit partial mock + proxy Entity

I tried find solution to my issue but didn't find anything. I use: Symfony, Doctrine, PhpUnit I have one entity class InvoiceNumerator: /** * InvoiceNumerat

Android Studio Start all unit tests, not instrumented

So far I've got bunch of tests in my multi module project. All of them could be run on PC... except one. It's intrumented test for Room DAO class. There is no p

Spring AOP with Mock, Spy. AspectJProxyFactory cannot addAspect Mock instance

I am trying unit tests where an aspect class works well while unit testing. Situtation. upgrade Spring Boot from 1.5.9 -> 2.3.1. Mockito, Junit frameworks ar

Spring AOP with Mock, Spy. AspectJProxyFactory cannot addAspect Mock instance

I am trying unit tests where an aspect class works well while unit testing. Situtation. upgrade Spring Boot from 1.5.9 -> 2.3.1. Mockito, Junit frameworks ar

How to create an adapter for the Visual Studio Test Explorer? [duplicate]

I'm a bit stuck with the problem of creating a custom adapter for the Visual Studio test explorer. (Btw I'm using VS 2019). I need to create m

Mock OpenSearch Client in jest unit test

I'm trying to mock out the opensearch client for testing purposes and am running into an error. My app is using OpenSearch (@opensearch-project/opensearch) and

XCode 13.1 Failed to generate coverage for target 'xx.app' at paths

Failed to generate coverage for target 'xx.app' at paths ( "/Users/bupozhuang/DeriveData/xxDemo-aacxrfgumjzqjncgymjnenzofsub/Build/Products/Debug-iphonesimulato

How to configure gradle to use logback-classic ONLY for unit tests in Android?

I have an Android app thich uses slf4j + logback. Gradle file looks like this: ... compile('com.github.tony19:logback-android-core:1.1.1-6') { exclude grou