Category "unit-testing"

Unit testing for python function-using post requests and get requests

I am trying to test the below function using unit test mocks but i am not able to do it since the return type from request get/post is of type <class 'reques

Test an array and random value PHPunit

I have a little problem with my unit test and an array generated "randomly", I have something looking like this : return [ 'foo' => $this->faker->sent

How test a ViewModel function that launch a viewModelScope coroutine? Android Kotlin

I´m trying to figure out the simplest way to test this kind on function members, I´ve seen more complex cases like Coroutines - unit testing viewMod

Visual Studio Code's "Run Test | Debug Test" option missing from unit tests

I used to see "Run Test | Debug Test" links top of every test function in VS Code for Go. But they are missing now. How can I re-enable them? This picture show

How to execute onPress on TouchableOpacity react-native using jest and @testing-library/react-native?

I have a component called Header that look like this: import React from 'react' import {StyleSheet, TouchableOpacity, View, StyleProp, ViewStyle} from 'react-na

How can I use the react testing library to test the style characteristics of an range input?

I need to get the styles of the input range-slider in javascript so i can test it. I have made a range slider component which accepts different style properties

Angular Testing and required input type="file" form validation

I have a case where I use NgForm validation on an input[type="file]. The code works fine in a real case scenario (browser usage). However on the testing part it

Test multidimensional array with Laravel and Pest

I have a little problem when I want to test an array in my unit test. I want to test both structure and type of keys, but I don't know how to process it (I trie

Mockito Capture argument of a Constructor in mockConstruction

I have the following classes: public class Bar { private final Listener mListener; public Bar(Listener listener) { mListener = listener; } } p

How to mock @Viewchild MatInput in angular unit test cases

I am trying to mock viewchild in my angular test cases. here is my html file <mat-form-field appearance="fill"> <mat-label>Date</mat-label> &l

How to mock jquery global $ with jasmine typescript?

I want to test a method in a service that uses the global $ as jquery reference like this: CLASSES_TO_FIND = ['highlight', 'normal']; fetchHighlightedTags():

Test a decorated function in Python

I have a Python function which is decorated. @retry_if_access_token_expired(app_id) def add_something( self, *, argument1,

how to coverage write file func in java

I made a simple function? to which I give a list of objects and then get their headers (just some strings), then sort and write to a file when i made a test for

Await not returning in SpecFlow async test step

I'm having trouble with some async SpecFlow unit tests where an await is never returning. I think that it is to do with the SpecFlow SynchronizationContext, but

MockMVC - Service method does not appeared to be called, works in postman, responding with null for test

I am trying to test the controller for creating a new league method, but it just returns null, and when I put a system.out.println in the service impl method, i

Kotlin Coroutines Unit Testing

Im trying to test this suspend function: suspend fun <T> getResult(call: suspend () -> Response<T>): Resource<T> { val response = call()

Unit testing with get request

I am trying to create a unit test for one of my api. In the frontend, I send it this way... params = { participants: JSON.stringify(participants), secti

Object not declared in this scope error in cpp?

I'm getting error SPIGtestMain.cpp:"MockObj not declared in this scope" though I've declared it globally in with extern keyword in SPIGtestMain.cpp file. SPIG

Object not declared in this scope error in cpp?

I'm getting error SPIGtestMain.cpp:"MockObj not declared in this scope" though I've declared it globally in with extern keyword in SPIGtestMain.cpp file. SPIG

Karma fails to load test file: "Failed to fetch dynamically imported module"

I'm trying to test my LitElement components with Karma but importing PDF.JS is causing the test file not to be loaded. Example of the LitElement component file