Category "unit-testing"

How to test if output function recieved is are correct or not using GTEST/GMOCK

I am trying implemnent the GTEST/GMOCK framework for unittesting the C-code. I am using the MSVS 2017. The adaptation is completed. Here, I have the matlab gene

Moq multiple generics i.e. LoadData<T,U>(string sproc)

I think I'm close, but just can't get the syntax. What am I missing for the Moq on this ? https://dotnetfiddle.net/1RItB5 Method to test public async Task<T&

`Executed 0 tests, with 0 failures (0 unexpected)` when running individual test cases in Xcode

When I run tests in Xcode, as long as I run all the tests collectively they execute normally. However, if I run only one individual test class or one individual

Restore NuGet packages failed for project ... : Could not find a part of the path

I'm trying to run a Unit Test project in Visual Studio (.NET Framework 4.72). The project is now building/running successfully, however there is still an error

How do you test a form upon the submission addEventListener with jest without a framework only vanilla JS

Most of the research I have done in regards to jest testing unit testing and/or integration testing is all heavily geared towards React. But I am not using reac

Python mock.patch() not mocking imported class module

I have a some code that looks like this (abridged): ## ./module_1/lambda_function.py from shared.graphql_helpers import GraphQLClient gql_client = GraphQLClie

Unit test for void method with Interface as parameter

New to Unit testing, I have below sample code and I want to create a unit test for this , Please suggest what should i do to create a unit test for this ? any l

Running a single test in WebStorm using Jest

I'm trying to run single test in my project. However every time I use triangle run icon WebStorm creates new configuration for me. I'm adding screenshots to cla

I modify response.data in Django REST Framework view.py. Why am I getting an AttributeError during testing but not with actual API use?

My Django REST Framework API is working just as expected. In view.py, I modify OrderViewSet, def partial_update, to add another key/value pair to the response.d

Unit testing useRouter's isReady

I have a component, which takes a parameter from the url and displays it. I implemented it using useRouter's isReady property. Something like this: import { use

JEST: My Isolated module function depends on a function found on the same module. After mocking, it still relies on the original implementation

I have abc.js const a = (a)=>{ return (b(a) + 1) } const b = (num)=>{ return(num + 1) } module.exports = { a, b } When I do my test for

Unusual Target Invocation Error in Unit Tests

I'm trying to run a group of 12 unit tests. When I run the entire group, one test passes and the rest fail with the same error: Could not find default endpoint

Is it bad practice to store/translate static error strings in a form field model?

I'm building a Flutter app where I have a sign-up form that will throw an error if the user inputs an invalid email. I have the following model for the email fo

How to Unit Test a method inside a module in NestJs (Jest)

I'm adding tests on a project and improving coverage. I would like to know how can I test a method defined inside a module definition in NestJs. import { Middle

Use DBUnit in Spring without defined entities via "nativequery"

I am trying to use DBunit while testing a Spring controller. The tests fail to initialize because my dataset contains tables/columns which are not defined by an

Can't add reference to System.Windows.Forms to .NET 5.0 Xunit unit test project

I have a solution in Visual Studio 2019 containing a WinForms .Net Framework 4.8 project and a .Net 5.0 test project. The WinForms project contains all my windo

Test functions cannot both take a 'done' callback

I'm trying to create a simple test with nestjs, and I'm get this error Test functions cannot both take a 'done' callback and return something. Either use a 'do

test class for handler trigger is not covered

I did a trigger on content version ,but my handler class is not covered ,can you please explain to me why ? please find below the code and screenshots for non c

can we mock method inside object

object Abc { method1(param1,param2):Future[Option[String]] = { //some work } } We are using method1 somewhere and need to stub method1 how can

PYTEST - Is it possible to create the same fixtures more than one time?

I have some parameters coming from a JSON file, and some fixtures in my conftest.py I would like to iterate all the option scenarios from my list and create my