Category "unit-testing"

Failed to load module 'project name'

I added unit test target to my existing project, but while @testable import Product_Module_Name getting error "Failed to load module 'Product_Module_Name'". I

Missing required module 'Firebase' for Unit test

i added Unit test target to existing project, when i @testable import Product_Module_Name in test class i am getting Missing required module 'Firebase' i am u

Error :StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete

My unit tests disappear from TestExplorer of visual Studio 2019 16.3.5 The output from test engine is: [16/10/2019 6:45:48.705 Error] StreamJsonRpc.Connectio

Svelte - Not able to fetch data from JSON file during jest unit testing

During unit testing, I am getting undefined error, while executing svelte component with json file. Restaurant.svelte : import data from '../Data/restaurants.js

Jest messageParent can only be used inside a worker

Is there a way to get a proper error message? when i do $npm test and I intentionally break my code(cough cough remove a line of code) I get this message src/re

In Corda flow tests, how to get the modularized cordapps assigned only to the respective parties?

As per the Corda coding guidelines, I have seperated out modules into contracts and workflows-common. There are workflows modules like workflows-party1, workflo

Trying to mock an http client that is inside a controller, using phpunit, but it doesn't work

I have to test the routes of a controller which uses Guzzle Wrapper as a client to get data from an API. The app uses Laravel as a framework. This is the part o

In Dart, how to verify a void method that does not throw exception in unit tests?

I am implementing some data verification library in Dart. The validating method has void return type and throws exceptions on errors. The code below shows an ex

DRF/Multi-tenant - How to specify tenant host (domain) in unit tests?

Environment - Django, Rest Framework, Multi-tenant. In my unit tests, I'm trying to hit an endpoint in a tenant schema (not in Public). It is failing because

Angular karma code coverage report folder not generated

When I run ng test --code-coverage, The coverage report is sometimes not generating, sometimes it is generating so I'm unable to verify the coverage statement a

What's the difference between a UI test and an E2E Test? And What's the benefits of each?

Our team is considering starting testing based on user scenarios. So, we are picking a E2E framework. Searching for UI test lead to the following: So, I found

How to test react component based on file reader emitted events

I have a react component called FileReader based off Dropzone react component (https://github.com/react-dropzone/react-dropzone). This file reader calls a callb

How to mock spacy models / Doc objects for unit tests?

Loading spacy models slows down running my unit tests. Is there a way to mock spacy models or Doc objects to speed up unit tests? Example of a current slow tes

Setting up IActionDescriptorCollectionProvider for a unit test

I am currently writing unit tests for a TagHelper that uses IActionDescriptorCollectionProvider in its constructor. My setupt looks as below so far - any ideas

Unit Testing for pgxpool

I am looking to write unit tests for Go code that uses pgxpool to interact with a postgres database. Is there a test framework that will stand up a dummy or moc

How to find the selected id in my List<String> ids arraylist?

Here is my code. I am trying to use JUnit to test the deleteUsers() method, but everytime I write my test, it deletes all the users that I have in the database.

Is there an equivalent of verifyZeroInteractions() for verifying an exact number of interaction with a mock object?

I would like to verify there were exactly x interactions with might db mock object. Is there something similar to the 'verifyZeroInteractions()' method for doin

Mock call to static method of a utility class

I need to write a unit test for the method processNotification. But this method internally calls JsonUtility.getNotificationDTOFromMessage. I need the return

Can we unit test memory allocation?

I have to test a library that provides its own memory allocation routine: void* allocation_routine(size_t size) throw(); Documentation states that this funct

Angular Unit Test for Http Error Interceptor not working

I have following http error interceptor: @Injectable() export class HttpErrorInterceptor implements HttpInterceptor { constructor(private util: UtilService,