Category "unit-testing"

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,

Using C# Moq testing getting Parameter count mismatch?

I know there are similar questions but somehow I am not able to figure out the situation in my case. I am getting Paramater count mismatch exception. Here is

component props not getting called on test cases

TypeError: Cannot read property 'setState' of null 251 | useStateSpy.mockImplementation((init) => [init, setState]); 252 | const component = shal

How to use GLOBAL FIXTURES in mocha JS to prepare preconditions of all test

I have read the document of mocha but can't follow the instruction. Because I have an Express Class like that // ExpressServer.js const http = require('http');

Angular v12 - Unit Test - [ERROR] No specs found

After developing my Angular application I would like to run unit tests with Karma and Jasmine. I haven't written any unit-tests yet, but trying to run the defau

Assert mock call with argument assigned in where block in Spock

I have a method that among others generates an identifier, sends it to some external dependency and returns it. I want to have a unit test that tests if the sam

Render() Modal test Jest Enzyme

I am not really how to test render() Modal. I am able to set up the props and test Render () " make sure it render with all the props" correctly " without any p

Mockito mock Java @Value with spring boot

Hi I have this simple code for my Spring Boot Project: @Component public class UserRowMapper implements RowMapper<User> { @Value("${bug.value}") p

EF Core xunit assert whether .Include was called

I've got extension methods in .net core that effectively dynamically evaluate stuff, and will call .Include() on an IQueryable<T>. I'd like to build unit

Jest did not exit one second after the test run has completed using express

I'm using JEST for unit testing my express routes. While running the yarn test all my test case are getting passed, but I'm getting an error Jest did not exi

Android Studio - ActivityInstrumentationTestCase2 not found?

I am trying to unit test my MainActivty. My project cannot find ActivityInstrumentationTestCase2 and android.test package. I changed the target SDK to 27 to see

Assert two List have same subtypes in a certain order

I would like to check if two lists (let's say, ArrayLists) have exactly the same instance classes, based in an expected List. To do so, I have built the next me

Jest: ReferenceError: global is not defined

So I am writing unit test using "react-testing-library" on Jest and I have this error: Test suite failed to run ReferenceError: global is not defined