Monday, October 18, 2004

I'm slowly catching up with putting some order in the MbUnit documentation. Therefore, MbUnit has now a Wiki (FlexWiki powered) part of the TestDriven.NET wiki. Feel free to contribute...

http://www.testdriven.net/wiki/default.aspx/MyWiki.MbUnit

Monday, June 06, 2005 4:54:48 PM UTC
Hey John,
<br>
<br>I asked you whether dotnetwiki for <a title="DotNetNuke, .NET portal" href="http://www.dotnetnuke.com" target="_blank">DotNetNuke</a> source was available for download, but I got no answer.
<br>
<br>So, is it available ?
Nick
Monday, June 06, 2005 4:54:48 PM UTC
Sorry about missing the answer but currently the wiki source is on my dev box, which is in a box, which is in another box, which should be in a plane soone... so I don't have access to the source and the backup cd's are on another box.
Jonathan de Halleux
Monday, June 06, 2005 4:54:48 PM UTC
<br>Does that kind of answer mean that you don't wanna share it ? :)
<br>
<br>If the source is not free to dl, no problem, I can understand
<br>
<br>cheers
Nick
Monday, June 06, 2005 4:54:49 PM UTC
The answer means: I'm moving between Belgium and the US, my stuff are packed and I can physically access them.
Jonathan de Halleux
Monday, June 06, 2005 4:54:49 PM UTC
Hi Jonathan,
<br>
<br>There's a bug in the NAnt task for <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>, most recent version.
<br>
<br>When running an <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> NAnt operation, the following error occurs:
<br>
<br>---- start ----
<br>[mbunit] System.ArgumentNullException: Value cannot be null.
<br>Parameter name: nameFormat
<br> at <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>.Core.Reports.HtmlReport.RenderToHtml(ReportResult result, String outputPath, String nameFormat)
<br> at <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>.Tasks.MbUnitTask.ExecuteTask()
<br> at NAnt.Core.Task.Execute()
<br>---- finish ----
<br>
<br>So the NAnt task calls RenderToHtml with a null nameFormat parameter -- in fact, the <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> NAnt task explicitly calls RenderToHtml with a null parameter, as shown by <a title="Reflector" href="http://www.aisto.com/roeder/dotnet/" target="_blank">Reflector</a>:
<br>
<br>---- start ----
<br>if (element2.Type == FormatterType.Html)
<br>{
<br> HtmlReport.RenderToHtml(result1, element2.OutputDirectory, null);
<br>}
<br>---- finish ----
<br>
<br>I suppose this can be fixed by inheriting from the NAnt task and overriding its ExecuteTask method, but can you please fix the error?
<br>
<br>Many thanks,
<br>
<br>Roy
Roy Dictus
Monday, June 06, 2005 4:54:49 PM UTC
Hi Jonathan,
<br>
<br>Actually, further investigation found that the nameFormat parameter is passed all the way up to the ReportBase.GetFileName method, which does nothing with it (other than throw an ArgumentNullException if the parameter is null :-) ...
<br>
<br>Kind regards,
<br>
<br>Roy
Roy Dictus
Monday, June 06, 2005 4:54:49 PM UTC
Hi again Jonathan,
<br>
<br>The problem described above can be solved by actually filling in the nameFormat parameter in the xxx.RenderToYyy() calls in the NAnt task's ExecuteTask() method.
<br>
<br>I have created a new NAnt task that inherits from yours, copied the decompiled source code into it, and modified the nulls in those calls to say &quot;MbUnitReport&quot; instead. Now the generation of reports works fine, and the reports are called MbUnitReport.html (I only use the HTML formatter).
<br>
<br>So I guess the best option to use would be to add a task element called nameformat to the NAnt task, and pass the contents of that element (property) to the Render calls.
<br>
<br>Thanks for making a great tool! :-)
<br>
<br>Roy
Roy Dictus
Monday, June 06, 2005 4:54:50 PM UTC
Hey Roy,
<br>
<br>Thank you for digging the issue for me. I have updated the <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> source with your fix (added NameFormat attribute to the nant task).
<br>
<br>The fix will be available in any version greater than 812d. This should be done today.
<br>
<br>ps: I still need to write some tests for the nant task :)
Jonathan de Halleux
Monday, June 06, 2005 4:54:50 PM UTC
Forgot to mention. The name format supports two arguement {0}, {1} which are respectively replaced by DateTime.Now.ToLongDateString() and DateTime.Now.ToLongTimeString()
<br>
<br>Default value is &quot;mbunit-result-{0}{1}&quot;, extension is automatically added.
Jonathan de Halleux
Monday, June 06, 2005 4:54:50 PM UTC
Great news, Jonathan!!
<br>
<br>Roy
Roy Dictus
Monday, June 06, 2005 4:54:50 PM UTC
I am coming from an NUNIT environment, and my test cases are riddled with Assertions like Assertion.AssertEquals.
<br>
<br>I have not been able to find the compatible class you mention inside <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>... can you point me to what I am missing?
<br>
<br>Thanks,
<br>John
John H Bergman
Monday, June 06, 2005 4:54:51 PM UTC
It seems that we need to add this to <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>.
<br>
<br>Actually, you should be able to do this yourself easily (temporary solution) by wrapping Assert in a Assertion class:
<br>
<br>public static Assertion
<br>{
<br> public static void AssertEquals(Object o1, Object o2)
<br> {
<br> Assert.AreEqual(o1,o2);
<br> }
<br> ...
<br>}
Jonathan de Halleux
Comments are closed.