Visual Studio 2013 running unit test - unit-testing

I'm using Visual Studio 2013, and I have a legacy solution that I need to modify, containing a a console application and a unit test project.
I want to run the console application project, and while it's running I also want to run one of my unit tests.
I run my console application, but when I go to the test explorer to run my unit test, the option is grayed out.
why is this, and how can I run my unit test?

You don't mention why you want to do this, so I'll just answer blind.
If you run your console app without debugging, then you can run your unit tests at the same time.
To run without debugging, use Ctrl+F5 (DEBUG -> Start Without Debugging).
Alternatively, open your console app's project folder, go to the bin\Debug folder and double-click on <your_app>.exe.
FWIW it doesn't sound like a very good idea to do this. Unit tests are meant to be runnable completely separately from your application.

Related

Troubles with executions of automation tests with Test Explorer in Visual Studio and MSTest

I use in my project SpecFlow to provide automation testing of web-site(with Selenium). I want create end-to-end test suite for provide full checking of project according to BDD. When I create tests playlist in test explorer in Visual Studio and start all tests in playlist all my tests launch according to their alphabetic name. But when I restart project and start this playlist newly all my tests launch in the wrong order. I think, that this problem may be because of rebuild playlist file, but I'm not sure. Could You help me, please?
TestRunner - MSTest

visual studio code unit test discovery frequency setting

When I'm updating my existing unit tests, Visual Studio code drops a status bar from the top letting me know that it could not correctly discover unit tests every time I save the file. This is expected since I'm actively typing so everything is not working python.
Have I configured something incorrectly? Is there some way to tell visual studio to chill out on the unit test discovery?
Of course, I can simply hit the "close" button, but this is extremely distracting.
Disable Live Unit Test running on the background.
Under Test->Test Settings-> uncheck 'Keep Test Execution Engine Running'. I am using VS 2017 & VS 2015.

.net core test not showing correctly in VS 2015 Test Explorer

I am trying to build unit tests for my dotnet core project using xunit following these steps outlined here https://xunit.github.io/docs/getting-started-dotnet-core.html
The problem I have is that any updates to the the unit tests are not reflected in VS 2015 Test Explorer. I have tried building the solution and then running the tests, but it's still not showing up or it's using the old build.
If I run the tests from the command line using "dotnet test", then everything works fine. When I go to the Test Explorer here after, it shows the updated and new unit tests. But I can't get the same to work in VS Test Explorer.
What I do now is, go to the command line, run "dotnet test", go back to VS and "Run All" from the Test Explorer to get the view updated with the new test results.
It seems that doing the build in VS and selecting "Run All" doesn't affect the assemblies used by the Test Explorer.
Can you help me get everything working from VS itself?
I am using Visual Studio 2015 Update 3.
Just ran into the same problem today: disable the test settings if you have any loaded. After that they started successfully showing up for me.

How can I set up unit tests to run for different environments?

I'm considering running unit tests for my Visual Studio 2010 projects on our build server at build time. The problem is that when I'm working locally, I want to test against DEV, when building for QA, I want the tests to run against QA, when building/promoting for UAT/PROD... you get the picture.
I think VS 2010 might have support for per-environment configs. If so, does this apply for test projects also? If not, what are some alternatives?
thanks,
Mark
I don't really have much experience with VS 2010, but there was no such functionality in VS 2008.
I usually have a msbuild script to build and run the tests of the solution. In your case I would have a step in the this script to set the correct configuration after the code was built and before the tests are run. I used XmlUpdate task from http://msbuildtasks.tigris.org/ last time.

How to avoid breaking build when committing Visual Studio Unit Tests in CruiseControl.Net

I'm having a problem when a project is committed to SVN, which in turn is automatically picked up by our newly set-up CruiseControl.NET server, the UnitTests are failing.
The unit tests are written in the default Visual Studio Unit test framework - which is the problem. I spot that nUnit appears to be recommended as a good alternative. However, that doesn't change my current predicament - I would like a working build without having to re-write every single one of my Unit Tests in the nUnit Framework (Would converting a MS Unit Test project take any considerable amount of time - it looks the same to me?)
What is the best way for me to proceed now? We are unable to install Visual Studio on the box and our IT department won't allow us access to go fiddling in the registry.
I am not sure how to run unit tests without Visual Studio, but I had moved to NUnit from MSTests and its reasonably easy - as long as you don't use the test context from MSTest(can't remember the real name), all you have to do is to rename the tags [TestClass] -> [TestFixture], etc (there is always 1-1 mapping) and change the usings. Running NUnit tests on the build machine is trivial.
Also you can try to convince your company to buy you a copy of Resharper (preferred), or TestDriven.NET - so you can easily run NUnit tests from Visual Studio.