Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Wednesday, 4 April 2012

Continuous Testing

Various software vendors have produced some useful Visual Studio tooling to help TDD and BDD for developers.

They range from automatic build and running of affected tests on save to showing you the location of failing tests and code coverage figures within the coding IDE.

If you would like a demo project with tests to try out some of these tools you can download the following solution:

http://stevenhollidge.com/blog-source-code/LibrarySystem.zip

And, (for me) the winner is…

NCrunch for Visual Studio 2010

NCrunch is an automated parallel continuous testing tool for Visual Studio .NET. It intelligently takes responsibility for running automated tests so that you don't have to, and it gives you a huge amount of useful information about your tests (such as code coverage and performance metrics) inline in your IDE while you work.

ncrunch

Here are the rest:

Continuous Testing for Visual Studio 2010

  • MSTest for Visual Studio 2010
  • NUnit v2.5 or later
  • XUnit v1.5 or later

Continuous Testing for Visual Studio auto-detects your unit tests and runs them each time you build your solution. It adds an error to your error list for each test that fails, allowing you to navigate to the line of the test that failed, just like you would navigate from a compile error.

Continuous Testing removes a manual step for you, making your workflow far more efficient. 

There is a free version and a professional paid version with various enhancements such as auto ordering tests and aborting a test run on a first test failure.

Link: http://visualstudiogallery.msdn.microsoft.com/c074d3c6-71e2-4628-9e7c-7690e706aef4

vs-integration

Demon from RedGate

demon

Demon takes over the Visual Studio build to compile and run tests only for code that has changed.  See the nice green bar down the left side gutter (to the right of the collapse +/-)?  That’s what Demon adds to show your changes are all good.  If your changes result in tests breaking it changes to red.  It’s still in beta and doesn’t seem to be successful all the time but hopefully by the time it comes out of beta this may well become a must have tool.

Link:  http://www.red-gate.com/products/dotnet-development/dotnet-demon/

Mighty Moose from Continuous Tests

continuoustests

Again, this tool runs tests on build only for code that has changed.  You also get code coverage numbers in the left hand side gutter to give you a heads up on how many tests cover the overall method.

Link:  http://continuoustests.com/

And, here’s some old school tooling

Here is a few quick screenshot reminders for anyone that hasn’t already used ReShaper, TestDriven.NET and NCover tools:

ReSharper from JetBrains

You get a nice visual test runner with ReSharper, plus the nice icons next to each test in the coding IDE to allow individual running or debugging of tests or test cases.  Test cases are where you use the same test with multiple attributes above the method signature to pass in different test cases.

resharper

image

UnitTest-results

Coverage

coverage2

NCover

coverage1

Link: http://www.ncover.com

Performance

perf

Friday, 30 March 2012

Debugging with SOS, SOSEX and Dumps in Visual Studio

Note: This has been tested on x86 machine, I’ll update at a later point for x64 machine.

SOS (Son of Strike) Debugging Extension

You’ll need to set the “Enable unmanaged code debugging” property on the project to true.

enable-unmanaged-code-debugging

From the Immediate window you can execute the following commands:

Task Command
Load the extension .load sos
Displays all .NET objects in memory
[memory table, item count and total size]
!DumpHeap –stat
Displays all instances of that particular type
[memory address, memory table, size]
!DumpHeap –mt <method table id>
Displays all objects holding a reference to an object address !gcroot <address>
Outputs the current Call Stack !CLRStack
Outputs info on objects on the heap !EEHeap -gc
Lists all threads !threads
Lists work threads info !threadpool

SOSEx is an extension that gives you more commands to help debugging (scroll to the end of the blog post for the link).

taskmanagerdumpheap -stat DumpHeap-GCRoot eeheap -gc 

Dumps

Once you create a dump from your process (.dmp file), you can load it back into Visual Studio and the IDE will load the source file and you’ll be able to look at the variables at that point in time.

You can generate a dump file from Visual Studio by hitting a breakpoint and selecting Debug > Save Dump As.  You can close your solution and open the dump file in Visual Studio. 

To generate a dump file in production take a look at SuperAssert.NET.

Save-dump-as

Link Resources

SOSEx: http://www.stevestechspot.com

SuperAssert.NET can help generate dump files in production: http://msdn.microsoft.com/en-us/magazine/cc188701.aspx

Install Windows SDK: http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

Monday, 23 May 2011

Debugger Canvas

There’s a cool new addition to the Visual Studio Power Tools that gives developers a more visual ride when debugging their applications.  Introducing the Debugger Canvas:

What a great new addition to the Visual Studio power tools!

For further details visit the Microsoft Research website:

http://research.microsoft.com/en-us/projects/debuggercanvas/