Category "unit-testing"

Error: Hilt Fragments must be attached to an @AndroidEntryPoint Activity

Fragment is not loading in Unit Test. Code: @RunWith(AndroidJUnit4::class) class DataFeature { @Test fun testEventFragment() { val fragmen

Why Jest tests are SOMETIMES failing on CircleCI?

I have Jest tests that are running against the dockerized Neo4j Database, and sometimes they fail on CircleCI. The error message for all 25+ of them is : thrown

Testing function that use useQuery @apollo/client with Jest

I am trying to unit test my function that call useQuery from @apollo/client. Here's what I have done getPixelID.ts import { useQuery } from '@apollo/client'; im

What's the point of writing unit tests with mocks, if it cannot catch changes in the source code?

I started writing unit tests recently. When I try to test the service of the Angular component, I usually mock it. Therefore, if someone deletes the line of the

DataBricks Python unit test error help needed

I have a problem with unit testing in DataBricks. I have not found any similar error message yet. Could someone please help me? Below you can find my code: impo

SpringBoot Liquibase Oracle Junit test case execution fails

I have a SpringBoot application in which i use Liquibase to generate oracle schema and tables. When i run the application, it runs fine. But when i try to run t

Using PowerMockito with ArgumentCaptor

I simply try to test the following part of my service method: if (isDeleted) { LoggingUtils.info("Deleted. ingredientUuuid: {}", ingredient.getUuid()); } I

Django rest framework: Unit testing post request gets status code 400

I'm doing some unit tests in this restaurant app, and the API request to cancel orders returns code 400 when running "manage.py test" command, but doing the sam

How to Mock QueryAsync using Dapper for unit testing an Oracle stored procedure call which returns a RefCursor

I am writing a unit test case using MOQ framework for testing an Oracle stored procedure returning a RefCursor. My project is in c# and we are using Dapper to c

Is there a way to mock Random.Next regardless of what gets passed to it and where it gets called?

I have the following method I wish to unit test: public class Board { public static BoardElement RandomElement(List<BoardElement> elements) {

Jasmine unit test Angular service with nested spies

I´m trying to test this Angular service which uses af.firestore.collection, not just af.collection, as shown below, so to be able to access the onSnapshot

Mocking federated modules in host application for jest

Question is exactly same here in fact but has different context: How to mock not installed npm package in jest? I am part of a project where new Module Federati

Scala Test: how to assert lenghty exception message securly and clean without hardcoding?

I have the following code, which is used to (sha) hash columns in a spark dataframe: import org.apache.spark.sql.DataFrame import org.apache.spark.sql.functions

jasmine window.location.reload in ngOnDestroy

public ngOnDestroy(): void { window.location.reload(); } How can I unit test this? All answers I found didn't work or only worked when the test was the only on

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