unit-testing Questions

5

Solved

I am trying to write a unittest to check the output of an engineering analysis. I have theoretical values which i want to check against the analysis to a certain number of significant figures. so, ...
Chiu asked 28/10, 2013 at 20:5

2

Using React Testing Library to test a dialog provider. I can get it to open, and assert on it appearing — but for some reason I can't get it to close in the test. Do I need to rerender or something...
Jeremiad asked 20/9, 2019 at 15:44

3

I'm trying to use firebase TestLab on iOS using this guide: https://firebase.google.com/docs/test-lab/ios/firebase-console#build_xctests_for_your_app but after I upload the zip file including the...
Kaliope asked 12/11, 2018 at 14:7

15

While running unit test in Visual studio , i was getting 0 Total Tests - 0 passed,0 failed ,0 skipped even after having tests in the class.
Cichocki asked 5/9, 2020 at 13:7

12

Solved

This question regards unit testing in Visual Studio using MSTest (this is important, because of MSTest's execution order). Both the method marked [TestInitialize] and the test class constructor wil...
Dichromate asked 2/12, 2008 at 16:15

5

Solved

I'm writing unit test. For testing the method below, public async Task<Guid> CreateWebJobStatus(string blobId, Guid loggedInUserId, string loggedInUserEmail) { Guid webJobStatusId = Guid....
Selfsufficient asked 7/3, 2018 at 1:6

9

Solved

As I understand it should be done so that useFocusEffect would work as useEffect for testing (mock). I use useFocusEffect for fetchData: useFocusEffect( useCallback(() => { fetchData(); }, [...
Aerograph asked 7/2, 2020 at 13:41

2

I am trying to use Jest.js to test some typescript code I wrote. I am getting an error "Error: Do not import @jest/globals outside of the Jest test environment" but I thought I was in a j...
Achaemenid asked 21/2, 2023 at 21:56

5

Solved

How can I skip a BOOST unit test? I would like to programatically skip some of my unit tests depending on, (for instance) the platform on which I am executing them. My current solution is: #define...
Sayer asked 4/6, 2013 at 23:13

91

I am currently working on a solution that has currently 32 Unittests. I have been working with the resharper test runner - which works fine. All tests are running, all tests are showing the right t...
Mcafee asked 29/4, 2014 at 11:14

3

I am trying to write unit tests for Quarkus using Mockito, but I fail mocking things. Here is a minimal (not) working example : package com.my.package; import io.quarkus.test.junit.QuarkusTest; im...
Parfitt asked 23/9, 2020 at 15:59

3

Solved

The Jest docs do not demonstrate a way of asserting that no exception was thrown, only that one was. expect(() => ...error...).toThrow(error) How do I assert if one was not thrown?
Afterdeck asked 1/4, 2018 at 22:48

4

Solved

I have a method that will return a list of objects of type MyClass. MyClass has many properties, but I care about type and count. I want to write a test that asserts that the returned list contains...
Watanabe asked 8/10, 2018 at 1:15

43

Solved

I have tried to run Parameterized Unit Tests in Android Studio, as shown below: import android.test.suitebuilder.annotation.SmallTest; import junit.framework.TestCase; import org.junit.Test; im...

8

Solved

Currently in my tests I do something like this to test if an email is queued to be sent assert_difference('ActionMailer::Base.deliveries.size', 1) do get :create_from_spreedly, {:user_id => ...
Rolf asked 14/1, 2010 at 10:30

1

After updating, my previously passing unit tests now fail with the error: 'TypeError: this._renderer.addClass is not a function' across multiple tests, despite not using or importing the renderer i...

5

Solved

I'm trying to test my controllers using xUnit but getting the following error during execution of Customer Controller: "The following constructor parameters did not have matching fixture data...
Hydrocarbon asked 3/7, 2018 at 13:35

4

Solved

I am writing a Flutter plugin that checks the Play Store or App Store to see if the app needs to be updated. I'm using the package_info package to determine the version of the app that the user has...
Ashmore asked 12/1, 2019 at 18:8

5

Solved

I have a simple Java method, I would like to check that it does not throw any exceptions. I have already mocked the parameters etc, however I am not sure how to use Mockito to test that no except...
Boutwell asked 10/8, 2016 at 8:56

3

Solved

I'm looking for documentation for .runsettings files as used with vstest. Is there an xsd? I can't seem to find much except for a few example files in the msdn documentation.

1

Solved

I'm basically trying to mock an external module in the same way for all my vitest tests, and it's surprisingly not trivial. In Jest, I would just create a __mocks__ folder at the root, and it appea...
Buzzell asked 10/5, 2023 at 0:18

12

I'm learning Angular and I want to do tests, but I'm stuck. I've got a function: ngOnInit(): void { this.route.paramMap .switchMap((params: ParamMap) => this.SomethingService.getSomething(p...
Philous asked 28/8, 2017 at 11:26

7

Solved

I'm trying to write unit tests for Stripe webhooks. The problem is I'm also verifying the stripe-signature and it fails as expected. Is there a way to pass a correct signature in tests to the webho...
Nadabas asked 15/12, 2020 at 13:20

4

Solved

I have a base class: public abstract class MyBaseClass { protected virtual void Method1() { } } and a derived class: public class MyDerivedClass : MyBaseClass { public void Method2() { ...
Resurrect asked 19/4, 2016 at 18:35

3

I am writing a unit test for embedded software code in python. One of the files require a specific file to exist. (e.g. "/dir_name/file_name.txt") otherwise it raises an error. Normally, this fil...
Somersomers asked 22/10, 2016 at 0:57

© 2022 - 2024 — McMap. All rights reserved.