Archives

Archives / 2003 / February
  • Debugging Tests

    If anyone has been having difficulty with the 'Debug Tests' functionality, there's a much more stable version up with build 92.  Go to the 'Tools' menu and 'Debug Tests'.  This will start a new test process with the debugger attached.  You can then set breakpoints, run tests and even compile new tests (which feels strange with the debugger still attached).  You won't be able to compile if the process has stopped on a breakpoint (the files will be locked).  It's not quite Edit & Continue, but if feels pretty close.  Let me know if you have any problems.

  • Spelunking with Ad Hoc Tests

    Here's a screenshot showing how easy it is to start spelunking about using Ad Hoc tests.  In the example below I've defined a class that creates and disposes of an app domain.  All the Ad Hoc test does is return the AppDomain object (which dumps all of its fields and properties).  If an Ad Hoc test method is static - the constructor and dispose methods won't be called.  Ad Hoc test methods can be private (you won't have to modify your code).  At the moment methods with parameters aren't supported.  A future version may pop up a dialog box for the parameters.

  • Immediate - Ad Hoc Tests

    Okay, as promised I've implemented Ad Hoc tests in the latest build. The idea is to allow any method to be used as an Ad Hoc test. If the class the method belongs to implements a constructor or the IDisposable interface, these will be used to set up and tear down the test (unless the method is static). If the method returns an object, its fields and properties will be displayed (in a similar format the the Immediate window).

  • Installing JUnit & NUnit TestRunners

    I've now consolidated the nunit and junit test runners into a single installer. I originaly split them because the junit test runner has a dependence on having the J# runtime installed. I had hoped that splitting them into merge modules would do the trick. Unfortunately it's not as simple as that. From what I can work out there is no way of optinally including a merge module in an installer. Instead you must optionally include individual components (files, registry entries etc.) in the merge module or installer. This is a problem when what you want to optionally install is a merge module. I have resorted to using Orca (the MSI editor) to add dependencies to the J# dependency merge module. Now the installer will only check for the J# runtime if the junit test runner is selected.

  • Stepping into IL while debugging

    .NET Brain Droppings
     This post came across the ADVANCED-DOTNET list several months ago and I had to post it. Many of us want to be able to step into the IL as we are debugging, but we can't. This suggestion was provided as a work around by Craig Andera and seconded by Mike Woodring.  It's a great way to view the IL as your debugging; lets hope MS will make this easier in the 2nd drop of .NET. You can find the post in the archives here.

    (1) decompile your assembly using ildasm to get an IL source file that includes the original high level language in interspersed comments.
    (2) recompile the IL into an assembly using ilasm.exe
    (3) debug the assembly; now able to see source+IL+asm

  • Pluggable TestRunners

    I've been moving towards a more extensible test runner framework. My first implementation using the new framework is support for junit. I was pleased to find that the 'junit.framework' assembly compiles out of the box with the J# compiler. I have made one minor tweak to it though. .NET behaves slightly different to Java when throwing exceptions. Java fills in the stack trace when an exception is created, whereas .NET does when it's thrown. I've modified junit so it stores the exception without rethrowing it. This preserves the useful stack trace information when a test fails.

  • eXtensible C# is cool!

    I've had a go and it really works! I've made a tweak to NUnitAddin so they play nicely together (save all files before build). eXtensible C# handles its assertions using the TraceListener framework. These messages will show up when running a subset of tests using the code context menu. Adding failing non-terminal assertions to the Task List is on my todo list.

  • Save, Build, Test

    The very anoying bug where source files weren't being saved before building and testing has been fixed!  This was only ever an issue for J# and C++ projects from what I can work out.

  • Trace and Debug Output

    Too many times I've found myself adding and removing Console output to my tests. I've added it when I need more information about how an individual test is running. I've removed it when cleaning up the output from running all tests in an assembly. I've found what I think is an effective solution.

  • Attaching to a Process using VS.NET Automation Model

    I've recently changed NUnitAddin so that it runs unit tests in an external process. It controls and communicates with this process using .NET remoting. Because tests are run in an external process it's possible to attach the VS.NET debugger set breakpoints on them. When I manually attach the CLR debugger (as follows) it works great.

  • Making Test a First Class Citizen

    The aim of the project is to make Test a first class citizen inside Visual Studio.NET. Test should be as integrated and natural a part of your development environment as Build is today. Wherever you find a Build action you could also expect to find a Test action. For example there is an action to Run Tests in a Project or Solution. There is also an action to Run Test(s) on the code context menu. Which tests are run depend on whether you click inside a Test, TestFixture or Namespace. Obviously this doesn't correspond to Build (until we get Edit & Continue that is ;). The corresponding Build action will be performed before any tests are run (Test depends on Build).

  • NUnitAddin Weblog

    Welcome to the NUnitAddin project weblog. My inspiration for starting this is Jeroen Frijters IKVM.NET Weblog. I have enjoyed watching his project progress over the months. Where as this is no way near as ambitious, I hope people will find it useful.