|
Why use Boo for Unit Testing your C# projects?Given that, just like in the java/jython world, many projects might still want to write their main app code in C# and all their unit tests in Boo - we should help people with this. In fact this might be an important key to the wider acceptance of Boo within the .NET community. How to do itI ran into a number of unresolved issues trying to get unit testing happening with Boo, but its was probably my inexperience - since I believe there are unit tests already for testing boo itself. However these unit tests might be written in C#? I'm talking about how to write unit test in Boo itself, for testing both Boo code and C# code. There is some info at http://boo.codehaus.org/Writing+Tests about unit testing and Boo.
THIS IS SOMEWHAT OUT OF DATE SINCE I CAN NOW WRITE UNIT TEST IN BOO SUCCESSFULLY - BUT THIS MAY BE OF SOME USE TO KEEP THIS INFO HERE. Basically, I cannot do what I want yet - here is where I got up to though: Original Post:I really want to be able to build some nunit tests for my boo experiments and want to avoid learning nant and delving into the innards of the way unit tests for boo itself are constructed. I just want to get a simple unit test class working from the command line. This is the boo source code containing a unit test written in Boo. I want this to run and invoke the unittesting framework and run the tests:
And my attempted commands: Using booi I get a path not found,
and using booc I get a No entry point found error.
Some limited success !!On the other hand I did have some limited success with the following script
As usual, booi didn't work and gave me the same file not found error as above. However booc did work (which incidently proves that my path reference to nunit framework dll DOES exist ;-) C:\boo\examples>..\bin\booc.exe -r:"C:\Program Files\NUnit 2.2\bin\nunit.framework.dll" "andy08 - nunit01.boo" And when I run it I get one pass and one failure, just as I expected :-)
- though it’s a bit verbose, and I got a windows dialog popping up asking if I want to debug the failure using visual studio etc. I said thanks but no thanks. Avoiding this pop up dialog would be good too. SummaryCan anyone clarify the meaning of all the above findings? Can anyone show the recommended simplest way of building nunit tests for boo? thanks, Didn't get an answer so I summarised thus:Referring to assemblies with -r: If you refer to an assembly with either booi.exe -r:SOMEASSEMBLY or booc.exe -r:SOMEASSEMBLY what happens when you refer to something that is not a "file dll on a path", but is rather a clean namespace reference. E.g. System.blah.blah - how does boo know where to find it? Is there a path similar to java's CLASSPATH that it/.NET consults? Got an answer :-)From: Rafael Teixeira <monoman@gmail.com> Got a clarificationFrom: Rodrigo B. de Oliveira <rodrigobamboo@gmail.com> Got a comment relating to MonoFrom: Bet's On! <l33ts0n@gmail.com> reply 1:From: Rodrigo B. de Oliveira <rodrigobamboo@gmail.com> reply 2:From: Rafael Teixeira <monoman@gmail.com>
Current State of writing unit tests using BooI don't know what to make of all the above information. I would like a definitive how-to answer, rather than more experimenting and prodding at things I don't quite understand. ContributionsPlease add your contributions! I will summarise and make a wikki page on the Boo confluence site.
CommentsHas booi.exe been improved since the time of this set of posts? (about oct 2004).
CommentsI've combined booi, booc, and booish into one tool. It supports references, multiple files, etc., and uses Mono.GetOptions. It likely will be included in a future version of boo. http://jira.codehaus.org/browse/BOO-209 Have you tried the SharpDevelop addin? It is even easier to use for compiling boo scripts.
CommentsDate: Tues, Mar 29 2005 10:11 pm From: Bet's On! (posted to list for your and everyone else's benefit) Here's your problem:
1: booi.exe is an interperter and does not support "-r." If you installed NUnit, you don't need the reference; it will be installed to the GAC, so all you need is "import NUnit.Framework" By default, booc.exe will try to compile a Console Application. This means that your source file needs an "entry point"; basically, code that is not encapsulated into a class. To avoid this, visit the Boo wiki about "how to compile" and use the command-line switch (the switch escapes me at the moment) to compile to a library. You get popups because you're not supposed to "run" Unit Tests; they're supposed to be run from the command-line using Nunit or the user interface for Nunit. Boo has a handy-dandy built-in "assert" keyword that is nowhere near as verbose as NUnit's Assert class. |