unit-testing Questions
1
I'm trying to create mocks from scratch that can pass the test issubclass(class_mock, base_class) where the base class is an abstract class derived from abc.ABC. Before you ask the question, I will...
Commix asked 4/12, 2019 at 10:55
6
Solved
In JUnit 5, there is a new annotation: @Nested.
I understand how the annotation works, I understand why we use nested classes,
I just don't understand why we need to have nested test classes.
Parceling asked 25/3, 2016 at 13:29
5
Solved
Methods setUp() and tearDown() are invoked before and after each test. But really, is there any real word example about why should I need this?
Inspecting other people tests, I always see somethin...
Signally asked 18/12, 2012 at 22:49
4
Solved
this kind of follows on from another question of mine.
Basically, once I have the code to access the file (will review the answers there in a minute) what would be the best way to test it?
I am thi...
Lea asked 3/9, 2008 at 12:39
9
Solved
can anyone help me get VS2017 to work with .NET Core test projects?
I tried creating both MSTest and xUnit unit test projects for .NET Core from the VS 2017 templates. Neither of them works in th...
Nanette asked 12/3, 2017 at 13:14
4
My question is How to setup multiple fixtures in one test class?
But the constructor of Zoo class can not handle multiple fixtures.
For exemple:
public class Zoo : IClassFixture<Tiger>, IC...
Brownfield asked 30/3, 2016 at 20:50
9
Solved
My unit tests disappear from TestExplorer of visual Studio 2019 16.3.5
The output from test engine is:
[16/10/2019 6:45:48.705 Error] StreamJsonRpc.ConnectionLostException: The JSON-RPC connectio...
Constance asked 16/10, 2019 at 18:1
2
Solved
Hi i am trying to get code coverage with .net5 in azure pipeline.
Run tests (not entire file)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results ...
Blatt asked 25/8, 2021 at 8:45
2
PS: Code will be in Koltin
For example, I have my service class that does something and injects some other service.
class MyService(
private val someOtherService: OtherService
) {
fun doSometh...
Diphosgene asked 14/10, 2019 at 10:21
1
I was trying to execute tests for my package over remote machine through ssh from my master node. Both nodes have same version of the packages installed.
I'm running test like this,
pytest -d --tx ...
Harhay asked 1/2, 2022 at 13:24
3
I write a test for a seletion and I get this warning. In my test I'm waiting for the end of the act. Why I get this error?
Warning: You seem to have overlapping act() calls, this is not supported....
Cardoso asked 30/1, 2022 at 13:9
2
Solved
I want to use jtest to do a unit test in the typescript (Node version v16.13.2) project. First I install the jtest "jest": "^27.5.1" and add jest.config.js file:
module.exports ...
Ammonify asked 2/3, 2022 at 11:15
9
Solved
I heard someone say that unit tests (e.g. nUnit, jUnit, xUnit) should be
DAMP not DRY
(E.g. unit tests should contain "damp code" not "dry code")
What are they talking about?
Dosi asked 23/6, 2011 at 11:22
3
Solved
I want to test class B:
class B : A {
override fun init() {
// do work here
}
}
class A {
protected fun init() { } // will be called by internal logic
}
and in Java there is no problem to c...
Conservancy asked 15/1, 2017 at 16:4
2
Solved
I want to test a function which invokes other async function and I don't know how to write it. Function would go like this:
function(X x, Y y) {
x.doSomethingAsync().then((result) {
if (result !...
Deeann asked 4/3, 2018 at 6:40
5
I am working with JUnit 5 and I want to create parameterized tests in a nested class. For example:
class CardTest {
@Nested
class Cost {
Stream<Arguments> cards() {
return Stream.of(
Arg...
Womanish asked 21/12, 2017 at 22:50
3
Solved
Issue
I have an Angular 9 app and just added a small unit test to a component. But VSCode doesn't recognize the types like describe, beforeEach, it. Although I have a tsconfig.spec.json file which...
Washday asked 24/3, 2020 at 12:16
9
Solved
Is there a way to capture a list of specific type using mockitos ArgumentCaptore. This doesn't work:
ArgumentCaptor<ArrayList<SomeType>> argument = ArgumentCaptor.forClass(ArrayList.cl...
Switcheroo asked 9/4, 2011 at 17:17
3
I have the following test suite:
class FooTest : FunSpec() {
init {
context("a context") {
test("first test") {
true shouldBe false
}
test("f:second test") {
t...
Disclaimer asked 11/3, 2020 at 9:52
9
Solved
I have a command line tool that performs a DNS check. If the DNS check succeeds, the command proceeds with further tasks. I am trying to write unit tests for this using Mockito. Here's my code:
pu...
Decollate asked 13/2, 2013 at 2:56
2
Some of my unit tests are failing after updating Microsoft.Extensions.Logging.Abstractions from Version=2.0.0.0 to Version=3.1.1.0.
I have an ILogger mocked as so:
var loggerMock = new Mock<IL...
Trader asked 11/5, 2020 at 20:37
3
Solved
I'm testing an angular service with Jest.
I can to mock my httpClient, but I have a problem it is that I cannot test a url with a parameter (ex: "http://localhost:8080/api/feature/num?id=25663").
...
Blessed asked 29/1, 2020 at 17:13
4
Solved
I am currently launching my suit of tests using this XML file:
<suite name="something">
<test name="generic valid compilation">
<parameter name="isValid" value="true"/>
<pa...
Naturism asked 22/4, 2011 at 1:12
8
Solved
I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ?
Kindergartner asked 9/9, 2008 at 13:58
4
Solved
We are currently converting some code that was using Assert.IsTrue(), Assert.AreEqual(), Assert.IsNotNull(), etc. The basic unit test assert Library for C#
We want to use FluentAssertions, like va...
Len asked 11/7, 2017 at 13:13
© 2022 - 2024 — McMap. All rights reserved.