unit-testing Questions

4

I'm trying to write some unit tests for ApiBaseHelper methods (responsible for all HTTP requests). class ApiBaseHelper { String _baseUrl = "${Config.get('apiUrl')}/"; Dio _dio = Dio().....
Teacart asked 14/4, 2022 at 14:19

5

How can I test JavaScript code without using an additional framework such as Mocha? Is it possible to create a unit test case, write test functions manually, test the code, etc.? I've tried to writ...
Pettish asked 4/10, 2019 at 19:25

3

I'm a newbie on test driven development, and I came across a section regarding testing/mocking a fetch api. But I'm struggling to write my own test. I built a simple weather app just to test/mock t...
Pressing asked 4/9, 2022 at 5:45

5

Solved

I'm testing a Single file component that uses vue router to watch $route. The problem is that I can't get the test to both change the route and trigger the watcher's function. The test file: imp...
Napkin asked 15/12, 2017 at 15:32

2

Solved

I am doing angular unit testing. Does TestBed.inject(service) create a new instance of the service? I was always under the assumption that TestBed.configureTestingModule() created the service and b...
Enenstein asked 3/6, 2021 at 4:40

2

Solved

I am working on a Spring boot application that uses Spring JPA with PostgreSQL. I am using @SpringBootTest(classes = <my package>.Application.class) to initialize my unit test for a controlle...
Papyrology asked 28/1, 2017 at 23:8

2

Solved

I have this file structure. When ı wrote pytest in my terminal. ı have this issue ! ModuleNotFoundError: No module named 'money_transactions_test' Hint: make sure your test modules/packages have ...
Rania asked 19/5, 2022 at 22:34

2

Solved

I'm trying to unit test a function that returns a promise. I'm having challenges verifying if the mocked functions are called. Here's what I've done., // codetotest.js const { SomeModule, isSomethi...
Flam asked 14/5, 2021 at 17:15

2

Solved

I have a Django model field with auto_now_add=True. How do I override the value for this field in my test? class ABC(models.Model): sent_at = models.DateTimeField(auto_now_add=True) class ABCFac...
Sophiesophism asked 10/8, 2021 at 15:50

4

I just want to see the output from a few simple println(...) in my Kotlin mulitplatform commonTest code. My build.gradle.kts looks a little like: import org.jetbrains.kotlin.gradle.plugin.mpp.Kotl...
Nichollenicholls asked 19/2, 2020 at 22:1

3

I have a resuable component, called DatePicker like this export interface IPDatePicker extends IProps { control: any label: string placeholder: string value?: string errorText?: string isRequ...
Wattage asked 6/4, 2022 at 4:51

4

Solved

My code includes an if block like this Service: import { isDevMode } from '@angular/core'; export class MyService { constructor() {} methodToTest(): { if (!isDevMode()) { doSomething(); } ...
Halfcock asked 17/7, 2018 at 21:37

3

Solved

I'm looking into using parallel unit tests for our project(s) and was wondering about any best practices for actually writing such parallel unit tests.
Calorie asked 27/10, 2009 at 9:35

5

Can we repeat Unit test case execution for a configurable number of times? For example, I have a Unit test script named Test_MyHardware that contains couple of test cases test_customHardware1 and ...
Pugh asked 28/11, 2012 at 13:1

3

Solved

I currently have the following basic Python class that I want to test: class Example: def run_steps(self): self.steps = 0 while self.steps < 4: self.step() def step(self): # some expen...

13

Solved

Error : No tests found to run - while debugging/running C# Unit test cases -- Visual studio 2017 15.5.1 not discovering test cases. Framework Microsoft.NET framework 4.6.1 Added Test adapters as ...
Abscise asked 3/4, 2018 at 9:55

5

Solved

I'm trying to test a method that uses net/http to make requests. Specifically what I'm trying to achieve is to inject a mock http.Client that responds with a certain JSON body type clientMock stru...
Arieariel asked 22/11, 2017 at 13:43

8

When there are a number of people working on a project, all of who could alter the database schema, what's the simplest way to unit test / test / verify it? The main suggestion we've had so far is ...
Weathering asked 13/1, 2009 at 17:8

3

Solved

I am unit testing a wrapper to the MongoDB C# driver. I have this line of code: Collection.Find(predicate).ToListAsync(); Where Collection is of type IMongoCollection<T> and Find(predicate...
Pierian asked 28/7, 2015 at 1:30

4

Solved

I run go test in my pkg directory and I get the test results printed to the console as they run, but it would be ideal if I could get them printed to a txt file or even a html file, is it possible ...
Morganstein asked 19/3, 2015 at 17:5

2

Solved

Class to test My TypeORM repository extends AbstractRepository: @EntityRepository(User) export class UsersRepository extends AbstractRepository<User> { async findByEmail(email: string): Pro...
Wellworn asked 29/12, 2021 at 15:9

4

Solved

I am using MS unit testing framework for testing my C# library. I have to open a file which I'm deploying using DeploymentItem attribute. But it is not deploying file to the Test deployment directo...

2

Solved

I am trying to verify in a test that a static method is called. I am using Mockito for this purpose. This question is similar to this. However, the solution suggested in the most upvoted reply is n...
Freaky asked 24/8, 2021 at 7:19

4

I am trying to do Catch2 Unit Testing in Visual Studio. I have created a small test project to practice. When I try to compile this test project, I get a linker error. I am now trying to diagnose t...
Wasteful asked 21/10, 2020 at 7:56

7

How do I debug my tests? For example, I POST to create an entry and expect it to validate and return a particular page. It works in the browser and in the shell, but the test is the only thing that...
Pickerel asked 19/10, 2012 at 20:29

© 2022 - 2024 — McMap. All rights reserved.