5 Comments

  • Roy,



    I wanted to try this out but ran into a snag...where can I get version 2.2.1 from? All that I can access on their web site is 2.2.0, and this does not support your classes. Thanks for any help



  • Thanks, that got me up and running. I tested this using v1.1 of the framework with v2.2.2 of nunit.



    Ran into some interesting things when testing a method that throws an exception. Given a simple routine that throws an exception...



    [Test]

    [ExpectedException(typeof(ArgumentException),"Argument was false.")]

    [SimpleTraceAttribute]

    public void TestFail()

    {

    NeedsTesting testMe = new NeedsTesting();

    Console.WriteLine("unitNeedsTesting.TestFail");

    int rtn = testMe.DoSomethingThatNeedsTesting(false);

    Assert.AreEqual(0,rtn,"Return value is incorrect.");

    }





    The trace attributes methods got called, but this consistently failed to pass the test even though it should have passed (i.e. the exception was thrown as expected). However, simply changing the order of the attributes to



    [SimpleTraceAttribute]

    [ExpectedException(typeof(ArgumentException),"Argument was false.")]



    caused the test to pass, but now the SimpleTraceAttribute methods did not get called. So there's something weird in the way that nunit evaluates attributes.



  • Do you know if these attributes will work with the NUnit DLL (2.3.0) distributed with Testdriven? I really like Testdriven and also prefer the simplicity of one installer. But I suspect the Testdriven DLL isn't quite current (despite their version number). Have you had the chance to try?

  • I don't think it willl...

    I sent word to Jamie cansdale about this though...

  • I've spent some time revising the way we do test case extensions. There are several problems with what's in 2.2.1 and 2.2.2.



    1. As indicated in Roy's post above, you don't get the effect of any other attributes - not ExpectedException, not even Ignore - when you implement a test case extension on the model of the RepeatedTest example.



    2. We have no way to indicate in what context a test case extension can play. Since some fixture extensions might be incompatible with a particlar test case extension, this is important.



    I'm working on a new revision that will take care of these problems - for source code builders it should be available this week - for others, I'm not sure when the next release will be.



Comments have been disabled for this content.