Category "unit-testing"

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

How to mock Spring WebFlux WebClient?

We wrote a small Spring Boot REST application, which performs a REST request on another REST endpoint. @RequestMapping("/api/v1") @SpringBootApplication @RestC

Mocking moment() and moment().format using jest

I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM

Mocking moment() and moment().format using jest

I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM

How to write a unit test for spring specification?

I created a builder class which construct Specifications object. It is used for creating queries for JpaSpecificationExecutor. The builder is used, because I ha

Cmocka - should we all be creating one executable per test for isolating static variables?

Failure Given the following cmocka test with a static variable in a dependency: main.c #include <stdarg.h> #include <stddef.h> #include <setjmp.h

Jest: Better way to disable console inside unit tests

I wonder if there is a better way to disable console errors inside a specific Jest test (i.e., restore the original console before/after each test). Here is my

google mock - can I call EXPECT_CALL multiple times on same mock object?

If I call EXPECT_CALL twice on the same mock object in the same TEST_F . . . what happens? Are the expectations appended to the mock object or does the second

Spy on the result of an Observable Subscription with Jasmine

I am Jasmine unit testing an angular component, which uses Observables. My component has this lifecycle hook that I am testing: ngOnInit() { this.dataService.

Debugging Go tests in Visual Studio Code

On my Windows machine, I have Visual Studio Code installed. To run tests manually, I go in console to projects folder and enter go test main_test.go It works

how to prevent jdbc from trying to connect to a mysql database during unit testing

I'm making an application for a school project, but I'm running into the issue that when I try to run the unit tests that it tries to connect to the database wh

Is there a way to get unit coverage percentage (eg from jacoco) on only new code?

My hypothethical scenario is this: I have run my junit tests and generated a jacoco file my git diff shows I have changed 10 lines of code Now the intersection

Is there a way to get unit coverage percentage (eg from jacoco) on only new code?

My hypothethical scenario is this: I have run my junit tests and generated a jacoco file my git diff shows I have changed 10 lines of code Now the intersection

Jest 27: How to reset mock for jest.spyOn(window, "setTimeout")?

I am updating a project from jest version 26 to jest version 27. As part of the update I had to switch from assertions on setTimeout to assertions on jest.spyOn