Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
132 views

How to speed up "Run until failure" function in Visual Studio Tests Explorer?

I have test that failed one time and I want to catch this failure once again. When I start test mannualy I have to wait until test to run will be determined and other ctivities, so one test run takes ...
GXtal's user avatar
  • 25
0 votes
0 answers
22 views

Visual Studio - Debug tests - `Aborted: Exit code is -42`

I have an old project I try to update. It is based on ASP.NET Zero 6.5.0. The Tests are based on Xunit. Since an unknown time, when I run a test in Debug, Visual Studo tells me Aborted: Exit code is -...
Damien R's user avatar
1 vote
2 answers
245 views

How to unit test MAUI app segment that uses the MainThread class

I am using xUnit to unit test my MAUI app. I am testing my ViewModel class. The issue that I have is that a segment of code uses: if (MainThread.IsMainThread) { DoSomething(); } else { ...
Toto's user avatar
  • 941
0 votes
0 answers
46 views

How to exclude certain projects from being tested in a .NET project using XUnit and Coverlet

So I have a API project, and a Services project in a Visual Studio Solution. I also have separate api.tests.csproj and services.tests.csproj projects. I have a command like dotnet test ... /p:...
stefdude1999's user avatar
0 votes
0 answers
10 views

Running xUnit tests of the same class in parralel in Visual Studio with Resharper

I'm running my xUnit tests in Visual Studio with Resharper. I design my tests to be independent. I've setup parralelism in Resharper options. Yet, tests within a same class don't run in parralel. I ...
François's user avatar
  • 3,264
0 votes
1 answer
36 views

How to ensure Visual Studio configuration for xunit fact and theory have Unit Trait Cetegory

Is there a way to specify visual studio configuration which ensures xunit fact and theory unit tests flags for missing [Trait("Category", "Unit")], this is to ensure code ...
roverphoenix's user avatar
0 votes
0 answers
67 views

VS2022 IDE Bug? Adding a unit test project to an existing solution is also adding duplicate files to the existing project

Not sure what is causing this odd behavior: Step1: I had a project, one solution , one project. C:\Repos\CatWeather So CatWeather.csproj and CatWeather.csproj are in this folder. Builds fine. OK. Now ...
Bohn's user avatar
  • 26.9k
0 votes
1 answer
88 views

How to test Process ExitCode value

I have a mechanism to kill process in some circumstances. Given *.exe requires *.dll's. Everything works fine in production and in NCrunch (if "Copy referenced assemblies to workspace" ...
S. Kalinowski's user avatar
0 votes
1 answer
63 views

Is it possible to view the order in which tests were run in Visual Studio?

I am investigating a Heisenbug in a large suite of tests in a VS solution. I suspect it may depend on the order in which the tests are run. Obviously this is not an ideal situation. But my question is,...
William Jockusch's user avatar
0 votes
0 answers
60 views

Visual Studio 2022, XUnit test project, cannot inspect object properties if the class has a property of a Type from NuGet

We tried this with both VS 2022 17.8.3, 17.9.0 and 17.9.1 which is currently the latest. Symptom: When running XUnit test and hitting a breakpoint and we try to inspect properties of an object it just ...
Trygve's user avatar
  • 2,521
0 votes
1 answer
27 views

xUnit in Visual Studio not running

I am new to xUnit with .NET Core. I am trying to run testing for a sample project in VS 2022. This is my test class: using DeskBooker.Core.Domain; using DeskBooker.Core.Processor; using Microsoft....
toto''s user avatar
  • 1,574
-1 votes
1 answer
33 views

.csproj properties page is not working VS4Mac 2022

Hello All I have a MAUI Solution with a Tests.csproj included. I am using VS4Mac 17.6.4 (build 472), The project is XUnit. When I right click that csproj i get a context menu with Properties on it. ...
Mark Wardell's user avatar
0 votes
0 answers
689 views

Visual Studio is doing a rebuild of the unmodified projects when tests are being run

We have a solution with ~80 projects. When we run, debug, or write tests, Visual Studio rebuilds projects unnecessarily even though I built the solution before and nothing in the code of the projects ...
Nițu's user avatar
  • 59
3 votes
3 answers
1k views

xUnit tests won't run due to exception during test discovery

I created a new xUnit test project in Visual Studio and add a couple simple tests. But when I try to run any of them, they don't run because, according to the Test output, the discovery is aborted. ...
Joe's user avatar
  • 6,738
1 vote
0 answers
333 views

Running Selenium tests on a locally run application in Visual Studio

I'm relatively new to working with Selenium. I'm writing integration tests for a locally run web application. I'm also a little bit new to testing web applications. But here's what I'm having trouble ...
JohnN's user avatar
  • 1,000
2 votes
0 answers
232 views

xUnit.Net is not using app.manifest for longPathAware

I am using xUnit.Net for my Unit- and Integrationtests in C#. In some tests I need to copy files or create directories. In some cases I have paths longer than MAX_PATH which is 260 characters long. To ...
MadMax's user avatar
  • 69
0 votes
0 answers
32 views

Is it possible to capture an object in Visual Studio on a breakpoint with all values, so it can be used to create moq objects for a Unit Test?

In Visual Studio, if I use Copy Value, it's only the value in the Locals window, like the name of the object. Is there a way to copy the whole object, values, lists, other objects underneath it? I ...
learntofix's user avatar
0 votes
0 answers
48 views

Unit test not fire breakpoint

I want to create unit test with theory attribute and custom data member which read a file. After creating custom data member debug not hit breakpoint (set on start of GetData method). I have no idea ...
SimLab's user avatar
  • 11
2 votes
1 answer
805 views

Visual Studio testing interface crashing

When I try to run some unit tests in Visual Studio, the Test Explorer starts the test then I get the following error indicator in Test Explorer: The test keeps in blue, it doesn't pass and neither ...
rbasniak's user avatar
  • 4,954
1 vote
4 answers
3k views

"No tests found to run" Xunit test not detected in Test explorer, Visual Studio 2022

As you guys can see on the screenshot, i can run my Xunit test through cmd, however in Test Explorer no test was found. I have these packages from nuget: <PackageReference Include="Microsoft....
NordicPanda's user avatar
0 votes
0 answers
492 views

How to generate [InlineData] dynamically on runtime in xunit [Theory]?

The task is to generate InlineData during runtime. I've tried inherited DataAttribute with my GetData() method, MemberData, ClassData generators. But after I build the test project, tests are already ...
alexei's user avatar
  • 1
1 vote
2 answers
862 views

Is there a way to quickly find out if a C# class has an xunit test on any of its methods in Visual Studio?

If I am looking at a class in Visual Studio, I want to know if any of its methods has a unit test on it. XUnit is being used. Is there a way to quickly find out if a C# class has a unit test and on ...
Tony_Henrich's user avatar
0 votes
0 answers
269 views

How can I give my test client the client secret without hardcoding it (in C#)?

So I am trying to run some tests on my project and one issue that I am having is that any method that requires me to create a test client returns the following error: System.Argument.NullException : ...
Pratik M's user avatar
0 votes
1 answer
372 views

How to print output in Visual Studio Test Explorer from F# and xUnit on success?

I am testing a client application that is requesting data from a database across the network. I have studied similar questions on SO, but they seem to apply several years ago before the really good ...
Alan Wayne's user avatar
  • 5,354
1 vote
1 answer
1k views

Where is the xUnit project type in Visual Studio 2022?

I just installed Visual Studio 2022 but I cannot add a new xUnit project. When I go to the File > New > Project... screen, the only type of test project it offers me is MSTest: I have added the ...
RSW's user avatar
  • 1,667
0 votes
1 answer
849 views

How Do I Make C# Tests Run in Order?

I remember reading on a forum that C# Unit/Integration/Functional tests run in alphabetically order but that doesn't seem to be the case. I have 1 file that holds all of my tests and I put them from ...
NextNightFlyer's user avatar
0 votes
0 answers
122 views

Test a button in C#

I have the following buttons in C# and i should test their functionality for a university project, but i have no idea how to do that. Watched a few tutorials on Nunit and Xunit but they didnt explain ...
Dora99's user avatar
  • 1
0 votes
0 answers
389 views

Test explorer not running all tests using xunit framework

I am using X unit framework in .NET test project and suddenly the test explorer stopped running all tests, but just a part of them(literally did nothing different for it to stop working). I tried to ...
nnchvxx's user avatar
  • 81
0 votes
0 answers
117 views

Single Unit Test Takes ~40-50ms But 10 Copies Majority Takes Less Than 1ms

Fixture public class AllFixture : IDisposable { public AllFixture() { var mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new UserStoryProfile()); }...
user avatar
52 votes
3 answers
98k views

How to get Code Coverage from Unit Tests in Visual Studio 2022 Community Edition?

I've downloaded the latest VS2022 v17.1 Community Edition and it doesn't come with Code Coverage built-in. I'm accustomed to the Enterprise Edition and all I can find is paid options for the Community ...
Jeremy Thompson's user avatar
0 votes
1 answer
258 views

Visual Studio "Project reference" references to lower version of package

Have two projects, lets assume "Project" & "Project.Tests" (xUnit project) Build fails after adding "Project" as a project reference to "Project.Tests" by ...
Mr Nobody's user avatar
2 votes
1 answer
962 views

How to create a Nuget package from Unit Test project

I have a useful extension for Xunit which I use through various .NET 3.1 projects. I want to build a NuGet package to easily distribute it. But when I add a Xunit dependency to my Visual Studio ...
Eugene Aseyev's user avatar
0 votes
1 answer
56 views

No tests discovered in Visual Studio with error "The SVsFileChangeEx service is unavailable"

What to do, if I don't see my xUnit tests discovered in the Test Explorer panel, and the Tests tab in the Output toolbox contains the error: "The SVsFileChangeEx service is unavailable".
Gerard Jaryczewski's user avatar
1 vote
0 answers
168 views

xunit tests have unexpectedly stopped working in visual studio 2019 .netcore 5

My unit tests have been working fine, ive just finished some additional development and now the tests dont work at all. They arent failing becuase of changes Ive made, they've simply stopped working. ...
misuk's user avatar
  • 225
3 votes
1 answer
3k views

How to exclude helper projects with "Test" in their name from unit testing?

We have a utility project named Foo.Testing.Common with helper classes for our real test projects, named things like Foo.Tests.Unit and Foo.Tests.Integration. The Common project doesn't have tests, ...
System.Cats.Lol's user avatar
1 vote
0 answers
23 views

Error while running threw installed application using c# [duplicate]

I am trying to check all installed Application and trying to uninstall the one application. But when I am running foreach loop I am getting exception My code is something like this: int a = 0; foreach ...
Kishan Bheemajiyani's user avatar
1 vote
0 answers
111 views

Forcing xUnit tests to run as a console app

My project (Terminal.Gui) makes extensive use of console APIs (it is a 'console GUI framework'). When our unit tests run (either in VS or with dotnet test) they run in an environment where the console ...
tig's user avatar
  • 3,483
0 votes
0 answers
1k views

Running unit test using Xunit

I have added a unit testing class and added the below references to my main class library in the UWP project. When I add a new class library and add my test classes there the test methods on the ...
Piumi ganegoda's user avatar
3 votes
0 answers
515 views

Overriding dispose method in multiple child classes

I am currently using Xunit to write some integration testing in my .NET Core project. As part of this, I am setting up the data and other information before running a test in my custom class. using ...
abbs's user avatar
  • 256
0 votes
1 answer
202 views

SSIS Unit-test not run well (incompatible)

I tried find and use a open source framework for start BI project with TDD . I choose SSISUNIT for step one. ssisUnit is a unit testing framework for SQL Server Integration Services. It is loosely ...
Amirhossein's user avatar
  • 1,241
0 votes
0 answers
782 views

How to use OpenCover for XUnit Test Coverage?

I would like to integrate OpenCover for XUnit test coverage to my Visual Studio project. I made a little example project just for testing the integration. My example solution OpenCoverProject has two ...
MarcoBot's user avatar
0 votes
0 answers
43 views

Autogenerated MsTest in design mode in Visual Studio, what is it and why?

I am finding myself creating integration tests to test stored procedures in my DB. So far I have always been a fan of xUnit but for once I tried to autogenerate in visual studio the related MsTests. ...
Tarta's user avatar
  • 2,015
0 votes
0 answers
564 views

How to force VS 2019 xunit tests to use a specific testhost.exe?

In the VS folder there are a bunch of testhost exe located. By default the testhost.exe is used. I know I can switch to x64 but the testhost targets .NET 4.0 which can get into the way when you rely ...
Alois Kraus's user avatar
  • 13.5k
1 vote
0 answers
268 views

How to dynamically load xunit tests?

I have a set of tests that are loaded dynamically using the ClassData decorator: using Xunit; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Interactions; using System....
Francisco Lemos's user avatar
1 vote
1 answer
5k views

Visual Studio 2019 suddenly requires nuget Microsoft.NET.Test.Sdk to run xUnit unit-tests

I'm using xUnit for implementing tests. I used to install the xUnit Visual Studio runner, xunit.runner.visualstudio nuget package to run tests using the VS GUI. Below is are xUnit-related branches of ...
Bahaa's user avatar
  • 1,737
2 votes
0 answers
191 views

XUnit: Breakpoints in methods refrenced by [MemberData] are not working

Using .net core 3.1, I added an xunit project to a solution with the following test class: using System.Collections.Generic; using Xunit; namespace BP { public class BreakPointFails { ...
Allan Xu's user avatar
  • 9,228
8 votes
0 answers
804 views

XUnit - VS2019 - Theory with inlinedata doesn't showing DisplayName in grouping

I have a xunit test with Theory and some InlineData. The theory has set the DisplayName property. The test window is showing a test for each InlineData with correct DisplayName but is showing too, a ...
André Scaravelli's user avatar
2 votes
0 answers
141 views

Display breakdown of CPU usage by function for unit test run

I have a set of xUnit tests, which I run using Test Explorer in Visual Studio. How can I show the CPU usage information usually available from the Visual Studio built-in diagnostic tools -- ...
Zev Spitz's user avatar
  • 15.2k
0 votes
0 answers
451 views

How can i set execution order of .feature file in specflow?

in my project, I have 2 feature file abc.feature xyz.feature I want to execute it in sequential order. As of now, those are getting executed in parallel. Note=> I'm using hooks. for BeforeTestRun ...
PiyuSh's user avatar
  • 15
0 votes
1 answer
487 views

Brackets are not included as Code Coverage for Unit Tests c# in VSO

There are some code coverage inconsistencies between the VSO build pipeline and Visual Studio local. We found that the code coverage in Visual Studio is higher because it counts brackets as part of ...
superninja's user avatar
  • 3,391