How to prevent Visual Studio from killing any process after test execution - visual-studio

I am using Visual Studio 2012 MSTest framework with Silk4NET plug in. Every time when a test case finishes running, the Application Under Test is killed. This is REALLY annoying because this makes inspection harder in that I have to re-run the test and have to manually stop the test code to investigate the issue.
Does anybody know if I can disable this feature in VS where it kills everything after test execution? Thank you!

You need to add a line to the test that sets CloseOnPlaybackCleanup flag to false:
browserWindowInstance.CloseOnPlaybackCleanup = false;
This flag was added in Visual Studio 2010 SP1. Here is an MSDN Blog post.

Related

ASSERT doesn't works in the application VS 2015

I have a problem with builded in debug mode application. I build this application in VS 2015. When I run it, ASSERT inside functions doesn't executed. I suspect that this is problem in some of VS 2015 settings, or maybe there are problems with windows kits or SDK.
Maybe somebody faced with the same situation?
I use Windows 7 Enterprise.
When I run it, ASSERT inside functions doesn't executed.
Please make sure you are select "Debug" in Visual Studio 2015 when you press F5 to run this application. Because the Debug.Assert() function only works when you debug your application. If you choose Release and start run your application, the Debug.Assert() function will not be executed.
In addition, please create a new project and add Debug.Assert() function to check whether this issue only occurs in this one specific project or all projects.
If only this specific project has this issue, please check the bool value in Debug.Assert() function, make sure it is false. If it is true, this function will not be executed.
If all projects has this issue, please check your Visual Studio 2015 version, confirm it has installed the latest update and check whether there has any third part VS packages installed that affect the Visual Studio debugger. You could run your Visual Studio 2015 in safe mode to verify this.

Test execution error in Visual Studio 2015 (worked in 2013)

We are in the process of upgrading from Visual Studio 2013 Update 5 to Visual Studio 2015 Update 1.
Our Solution has many tests and we use NUnit 2.6.4, along with the NUnit Test Adapter for NUnit 2.x.
When running these tests in Visual Studio 2013, they all run perfectly well.
However, when running in Visual Studio 2015 the first 200 odd tests run, then execution stops. I can then select the tests that have not yet run and successfully execute these. I have the latest ReSharper installed in both VS2013 and VS2015 and it happily executes all the tests.
We've been keeping test-coverage details for each release since the dawn of time, and from Visual Studio's test runner it shows me the number of blocks covered. But ReSharper shows us the number of statements covered. Slightly different values, but they'd mess up our charts.
When test execution fails, it creates a Dump file (it also creates some XML files that just seem to show what DLLs I've installed). I can open this and "debug" it, but it simply shows me a line of code that fails, and the call stack shows only [Managed Code], which means I can't identify the actual test that's causing the issue.
The fact that this works perfectly in VS2013 and in ReSharper running in VS2015 suggests that "it's not our fault", but whilst I'd like to think that, it doesn't help me fix this.
Any ideas?
Thanks
Griff
Tracked down the problem. We had one class in our Solution that implements IDispose and one of our Unit tests didn't dispose of that class, it just allowed it to go out of scope.
So because the Disposable object hadn't been disposed, the class' Finalizer hadn't been suppressed. The GC therefore called the Finalizer which in turn attempted to access another object that had also gone out of scope, resulting in an exception that crashed the Test Execution Runner.
Interesting that VS2015 running NUnit 2.x crashes, but the identical setup in VS2013 copes fine.
As an aside, when debugging the DUMP file (see above), I realized that the call stack was irrelevant, I just had to put in some defensive coding in the Finalizer.

Visual Studio Unit Test: Huge startup delay in debug Mode

I'm working on a big code project. When I try to run a unit test in debug mode using nunit on Visual Studio 2013 Ultimate, there's a consistent 40 second delay before the test runs. Now, once the test starts running, it runs as fast as I'd expect. And if I run the test in Release mode, there's no delay.
I know it's a local environment problem because other developers report no similar delay when they fire up a test on the project.
I've been unable to determine what's causing this delay. The only visual evidence is that the cursor changes to a spinning cursor. I've disabled everything in Options that looked like it might be demanding. I have NCrunch and Resharper installed, but both are disabled, so neither appears to be at fault.
Any suggestions?

Debugging code that's being tested in Visual Studio 2010

I am having some problems with a given test, that I'd like to debug the code that is being tested, while the test runs.
Is this possible?
If yes, how can I just debug this one test? I can only see options for running or the whole solution, or the whole set of tests in the current context or all impacted tests. I'd like to just run this one test, if possible!
I'm running Visual Studio 2010.
Put a breakpoint in the test and run the test with debug - use the test explorer to select just that test and "run selected".
See this MSDN page (How to: Run Automated Tests from Microsoft Visual Studio).

How to set a breakpoint in a Nunit test and step through with Visual WebDeveloper 2008?

I have written a NUnit test in Visual Web Developer 2008 Express. But when I run the test, it doesn't pause at the breakpoint I had set. It just keeps on running but at the breakpoint, I need a step-by-step view on the test.
Could anyone please tell me how I can use breakpoints with NUnit?
Thanks in advance!
This is how you do it... - http://codebetter.com/blogs/paul.laudeman/archive/2004/03/18/NUnit-Tip_3A00_-Debugging-your-unit-tests.aspx
However I'm not sure if Express editions of VS support 'start external program' for debugging / 'attaching to a process'. In which case, you may need to upgrade to be able to debug.
This is easily done with VS C# Express - have a look at:
http://www.dotnet-developer.de/2009/10/aspnet2005/how-to-use-nunit-with-visual-studio-express-2008/
However I don't know if this will apply to Web Developer.
I assume you are running NUnit from outside Visual Studio, since the Express versions do not support Plugins. I don't think you can debug NUnit tests that way. If you had a non-Express version you could use the testdriven.net-plugin for debugging. Maybe if you set the NUnit runner as program to execute on debugging with you assembly as command line parameter...

Resources