unit-testing Questions
2
Solved
Is it possible to execute several nested tests in between of some other tests with a fixed execution order?
E.g.
@TestInstance(Lifecycle.PER_CLASS)
@TestMethodOrder(OrderAnnotation.class)
class M...
Grabble asked 2/4, 2019 at 13:30
9
I'm trying to mock new Date() to return a specific date. The following code:
const now = new Date()
jest.spyOn(global, 'Date').mockImplementation(() => now)
gives a compilation error: Argumen...
Cockaigne asked 29/3, 2020 at 8:59
5
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 that the NuGet packages can't be rest...
Loosing asked 8/3, 2022 at 18:54
3
Solved
I am trying to use unit-tests with Racket.
Usually, I am successful and I really like rackunit. However, I am having trouble with this specific case.
The function to be tested outputs two values....
Serinaserine asked 10/12, 2016 at 23:26
4
I want to integrate PyTest with Visual Studio so my tests show up in the Test Explorer. So far I have not found any way to do this while some old posts here suggest that people have done it before....
Aguilar asked 17/2, 2018 at 3:18
2
Solved
Since the test-function aborts on a failure, one cannot simply clean up at the end of the function under test.
From testing frameworks in other languages, there's usually a way to setup a callback...
Karyosome asked 7/7, 2016 at 18:58
6
Solved
If we have a unit test file my-spec.js and running with mocha:
mocha my-spec.js
The default timeout will be 2000 ms. It can be overwritten for partial test with a command line parameter:
moch...
Roush asked 6/5, 2014 at 10:23
10
Solved
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/j...
Unbelief asked 24/6, 2017 at 23:11
11
Solved
I am trying to create a Mock (using Moq) for an IServiceProvider so that I can test my repository class:
public class ApiResourceRepository : IApiResourceRepository
{
private readonly IServicePro...
Charron asked 2/6, 2017 at 19:53
5
Solved
I'm building a React app with TypeScript. I do my component tests with react-testing-library.
I'm buildilng a parallax component for my landing page.
The component is passed the image via props a...
Silvanus asked 2/11, 2018 at 13:4
8
Solved
I am having trouble changing the behaviour of a mocked module in Jest. I want to mock different behaviours to test how my code will act under those differing circumstances. I don't know how to do t...
Consentaneous asked 10/7, 2017 at 7:38
2
I have a scenario in which I need much of the information from the FileInfo structure -- creation time, last write time, file size, etc. I need to be able to get this information cleanly, but also ...
Unbelt asked 17/5, 2017 at 16:2
2
For python unit tests, is the following a common naming convention?
MyProject/
run_ingest.py
tests/
run_ingest.py
Or is this too redundant? If so, what would be a better naming conventi...
Polenta asked 21/2, 2019 at 1:17
2
Solved
We have an asynchronous task that performs a potentially long-running calculation for an object. The result is then cached on the object. To prevent multiple tasks from repeating the same work, we ...
Virtuosic asked 7/1, 2010 at 1:20
4
Solved
When running my functional tests, I'm getting the following warning in one of the test cases but I can't pinpoint where it's coming from:
gems/actionpack-2.3.8/lib/action_controller/record_identif...
Drake asked 8/9, 2010 at 21:15
3
Solved
I've read lots of documentation about testing controllers using $this->call($destination, $parameters, 'GET'); but this seems to rely on the route being set up too, and knowing the right $destin...
Delve asked 26/9, 2013 at 13:33
7
Solved
I have some codes like below, I want to write unit tests my method. But I'm stuck in async methods. Can you help me please ?
public class Panel
{
public int Id { get; set; }
[Required] public d...
Vesica asked 25/6, 2018 at 12:12
2
In Angular project (Angular CLI: 9.1.4) I have a component with has function using window.location.href = EXTERNAL_URL
a.component.ts
import { Component, OnInit } from '@angular/core';
import { Ser...
Iover asked 15/7, 2021 at 8:12
9
Solved
I tried to use the norecursedirs option inside setup.cfg to tell py.test not to collect tests from certain directories but it seems it does ignore it.
[tool:pytest]
norecursedirs=lib/third
When ...
Advocate asked 20/6, 2012 at 9:57
2
I have a code like below
expect(insertedData).toEqual({
id: expect.any(String),
clientId: 'client1',
...
I expect id should match any string, but what I get as result is
Not sure what I misse...
Tetracaine asked 7/12, 2020 at 0:20
4
Solved
Angular 4 unit test for a subscribe.
I want to test that my subscribe returns an array of Users.
I want to mock a list of users and test a function called getUsers.
The subscribe unit test doesnt...
Ysabel asked 23/8, 2017 at 12:38
5
Could someone suggest me a solution why when I run the test using command mvn test to run the cucumber runner class ExampleRunnerTest located in \src\test\java it runs but the maven build doesn't r...
Exhalant asked 29/6, 2015 at 13:46
6
Solved
I would like to write tests for a C library, in C. I'd like to mock out some functions for the test.
Suppose my library is compiled from the following source:
/* foo.h */
int myfunction(int x, in...
Icelandic asked 22/1, 2012 at 5:11
2
I have an input field and wish to stimulate the type-in during a unit test. Tried all the methods recommended on internet but still no luck, here is my code:
// In component
<div className="...
Bodgie asked 5/8, 2022 at 18:13
3
Solved
How do I test that a function won't produce a segmentation fault?
Here what I know right now, I can do:
EXPECT_DEATH(foo(nullParameter))
In side the function, a segmentation fault is produce wh...
Bernard asked 30/11, 2017 at 22:0
© 2022 - 2024 — McMap. All rights reserved.