Questions tagged [nunit]
NUnit is an open source unit testing framework for .NET written in C#. It serves the same purpose as JUnit or TestNG does in the Java world, and is one of many in the xUnit family.
nunit
7,517
questions
0
votes
1
answer
22
views
From where does Environment.GetEnvironmentVariable pick its value in nunit and referenced blazor web assembly
I was actually trying this code section in NUnit .
using NUnit.Framework;
namespace BlazorClientApp.Tests
{
public class CounterTests
{
[Test]
public void ...
0
votes
0
answers
6
views
Managing services with fixed ports in NUnit tests to prevent port conflicts
I'm working on NUnit tests where each test case requires starting a service that uses a fixed port. The challenge I'm facing is ensuring that the service setup ([SetUp] method) runs only once per test ...
0
votes
0
answers
10
views
BoDi.ObjectContainerException : Interface cannot be resolved Techtalk.SpecFlow.UnitTestProvider.IUnitTestRuntimeProvider('nunit') error SpecFlow
I am trying to run Nunit Specflow Tests using TestCentric GUI, I can load the test dll but when I run the test, I get the following error
OneTimeSetup:Bodi.ObjectContainerException : Interface cannot ...
0
votes
0
answers
9
views
Retry Nunit Specflow Playwright
I am using Playwright Specflow in Nunit to automate web applications. There are some flaky tests and I want to retry them automatically.
I've tried using NUnitRetry.SpecFlowPlugin but it doesn't retry ...
1
vote
2
answers
33
views
How to mock IConfiguration.GetSection("foo").get<Type>();
I am new to unit testing...
I have a class Settings.cs,
public class Settings
{
public string Format { get; set; }
}
and this is what the appSettings.json contains,
"AppSettings": {
...
0
votes
0
answers
10
views
How can I fix this NUnit testing issue?
I have test data and test like this below:
private static TestDataClass[] _data =
[
new() {Id = 10, ..},
new() {Id = 20, .. },
...
new() {Id = 170, .. }
]
[Test]
[...
0
votes
0
answers
12
views
How to handle modal dialog using C# and VUEJS in selenium webdriver?
DuplicateCancel
In the html below, How to handle the button "Duplicate" in a modal box using C# and Web Driver based on VUEJS?
0
votes
0
answers
13
views
Run MSTest programmatically
I have an existing library containing unit tests. I want to transform that library into a service that periodically runs the unit tests and emit metrics. I solved the bits to create a service and to ...
-1
votes
0
answers
20
views
nnUNet - how can I run a prediction on a test set that was extracted from a different tif file than the training set?
I am doing image segmentation in 2D using nnUNet. I have 3D tif files, images and masks.
in ordrer to train the model and make the data fit to the pipeline of nnUNet I am slicing the tif files so each ...
0
votes
0
answers
18
views
How to use one namespace into an another namespace in same solution?
I'm facing one issue . How to use one namespace into an another namespace in same solution?
I'm attached the code for your reference.
using namespace Dapper
{
namespace DapperTest.Repositories
...
0
votes
0
answers
32
views
How to load env vars from .env before running C# tests through VS Code
I am trying to get rid of the .runsettings file which I have in my project repo and keep all my config variables in a single .env file.
The one place where I am stuck in is in the scenario when ...
0
votes
1
answer
69
views
"Code Coverage Results" Missing in Visual Studio
I'm really new to testing, just starting out. I understood there should be a tab "Code Coverage Results" which can be opened from the Test tab, or by right-clicking on a test, but it doesn't ...
0
votes
0
answers
15
views
Nunit 4 assert text does not have assert statment inside () Eeg.: Assert.That(, )
c# net4.6.2 + nunit 4.1
test code
[Test]
public void DummyMethod()
{
var someVar = false;
Assert.Multiple(() =>
{
...
0
votes
0
answers
44
views
Wrong Appsettings.json picked at build with Unit test project referencing another project with its own appsettings
With Visual Studio 2022 in C#, we are referencing from our Unit tests project another project which is a WebApplication.
The web application is tested using Microsoft's WebApplicationFactory ASP.Net ...
0
votes
1
answer
135
views
How to Mock FunctionContext in Azure Isolated worker Model Function .Net 8
I have an Azure function in Isolated worker model type with .Net 8 version . I want to mock the function context for Unit testing.
Below code of Azure Function is given
using Microsoft.AspNetCore.Http;...