Category "unit-testing"

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

Ignore firebase related exceptions in Roboelectric unit test

My Roboelectric unit tests are giving this exception when I try to initialise Firebase in the Application class. java.lang.IllegalStateException: Default Fireb

Why does Pytest create a new class instance for each test method?

I was reading the Pytest documentation when I noticed a section titled "Grouping multiple tests in a class". There's a paragraph below with a caveat that each t

How to test multiple different type return value in unit test?

My code and test code are as follows: return two value, one is vector, and is boolean. Using command to test is ok. But in unit test it is in error. command tes

How to mock an environment variable that is referenced in an imported module?

I have created a file containing environment variables and I am writing a test for this file. The file ("my_variables.py") looks like: import os if os.getenv("

VectorCast vs GTest for unit tests

I am a newbie at VectorCast. I have developed some unit tests with VectorCast. But I am still not confident with VectorCast(maybe, I am wrong:) ). For unit test

Is it is possible to test only one function from component with Jest?

I have react component, for example something like this: const MyComponent = (props) => { const [state, setState] = useState(true); const {data} = useCon

How to run a test multiple times in Cypress.io

I have a test case to fix a bug that appears 1 in X times. I'd like to run the same test multiple times but I can't find any documentation that explains how to

Sinon.js combining calledWith number of times

I know with sinon.js you can test that a spy was called a certain number of times: sinon.assert.calledTwice(mySpy.someMethod); And you can test that a spy wa