I have a unit test project in Visual Studio 2022.
The project works perfectly on a first machine. However, I'm trying to run the same project in a new machine but I'm unable.
The tests just don't run. No error, no exception, nothing.
Visual Studio shows : Test run finished: 0 Tests (0 passed, 0 Failed, 0 Skipped) run in < 1 ms.
Both the test and the projects are set to x64.
Does anyone know any idea how to investigate why VS doesn't run the tests please ?
Thanks.
Cheers,
Related
I had everything working until a few days ago. After latest update of VS, VS is not able to discover tests. I have tried updating MSTest.TestFramework, MSTest.TestAdapter, Microsoft.Net.Test.sdk nuget pacakges as well but VS studio is still not able to discover the tests.
Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter.
[12/21/2019 11:19:36 AM Warning] No test matches the given testcase filter `FullyQualifiedName=Microsoft.ConvAI.FrontEnd.End2EndTests.ConvAIClientTests.VerifyBotGetsRecognitions` in D:\Git\Skyman\conversational-ai\src\Testing\Microsoft.ConvAI.FrontEnd.End2EndTests\bin\Debug\netcoreapp2.1\Microsoft.ConvAI.FrontEnd.End2EndTests.dll
[12/21/2019 11:19:36 AM Informational] ========== Run test finished: 0 run (0:00:07.7975681) ==========
Can someone please help me to fix this?
It was runsettings file which I had to uncheck "Run settings file" from "configure run setting" option under test menu.
After we upgrade to VS2019 and use VS test task v2.0 in Azure DevOps, our test task keeps failing with the following message:
Our Visual Studio 2019 is version: 16.2.5
The task version is: Visual Studio Test 2.157.3
What's wrong with the VS test task?
Update, the error message is:
[error]Error: The process 'C:\BldWorkarea\SLB1_VSTS\ZhouShuRen_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.157.3\Modules\DTAExecutionHost.exe' failed with exit code 1
VS Test fail in Azure DevOps while all tests are sucessed
It seems the issue for the version of that VS test task. You can check the following ticket for some more details:
VSTest 2.154.0\Modules\DTAExecutionHost.exe' failed with exit code 1
As workaround, you can switch the task back to V1.
Hope this helps.
I have an ASP.NET core 1.0 project I created in Visual Studio 2015 (update 3). If I try to build the project within VS I get the following in my output window and there are no errors in the Error List:
1>------ Build started: Project: QuickStartIdentiyServer4, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
However, if I build the project using the dotnet CLI command (dotnet build) it builds and runs just fine.
UPDATE:
Apparently, .net core does not work properly when running Visual Studio as Admin. You would think everything should work as Admin, I guess not... go figure.
There are simply too many reasons why this type of thing might happen. The easiest way to diagnose the problem is to change the build output verbosity under options to verbose. This might help put you on the trail:
With regards to this type of thing happening with .Net Core and ASP Core. I have noticed that the project.json dependencies json fragment is a bit buggy especially if you start renaming projects and changing their file system location.
If you see in the diagnostic below you know there is some dangling reference issue:
Done building target "_GetDependencyFragmentFiles" in project "<<?YOUR_CORE_PROJECT?>>.xproj" -- FAILED
May be you are not seeing build errors. Go to Error List window and change 'Show Issues generated' box from 'Build + Intellisense' to 'Build Only' and try to build again.
See if this helps.
In Jenkins I create a Visual studio project using MSBuild. After the build I execute a windows batch command that executes the tests en sets the output file.
Post build I publish the .trx test report file. This all works perfect, the only problem is that if a test fails the build fails. With other types of projects if a test fails the build only becomes unstable.
How can I do the same for my Visual studio project?
Below my batch command:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:TestAppTests\bin\Debug\TestAppTests.dll /resultsfile:TestResults.trx
I know it's pretty old but here are something as I've encountered the same type of problem.
Using Batch:
At the end of that batch command step where you run the tests, add one more exit command, such as exit /b 0 or exit 0.
Using Powershell:
At the end of the powershell command step where you run the tests, same, manually set the exit code $LastExitCode = 0.
Final:
The result will always be set to success no matter how many tests failed so you need to parse and analyze the result yourself. There are tools such as: https://plugins.jenkins.io/mstest and https://plugins.jenkins.io/xunit.
When I go to Test > Analyze Code coverage > All Tests, the output is "0 found". How do I get Visual Studio 2013 to pick up my XUnit tests?
This shows up in the output window the first time I try (Output > Tests).
------ Discover test started ------
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit VS Adapter 2.0.0.0 discovering test is finished
========== Discover test finished: 0 found (0:00:00.4240424) ==========
If I try a second time, the output window is blank.
Am I supposed to look somewhere else?
I'm using ReSharper to run my tests. ReSharper works, but VS's Test > Run all Tests doesn't find any tests either.
As per Lex Li, I installed the NuGet package xunit.runner.visualstudio, which resolved the issue