Re: JUnit / newbie question
Daniel Bonniot <[email protected]>
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
>To get JUnit to run tests written in Nice, I do the following:
>
>// TestInterface.java
>public interface TestInterface {
> public void test();
>}
>
>// Test.nice
>import junit.framework.*;
>public class Test extends TestCase implements TestInterface {
> test() {
> assertTrue(true);
> }
>}
>
>Is this the easiest way to run Nice unit tests with JUnit? It also
>gives me a compile error saying that assertTrue is not declared
>(assertTrue is a method in TestCase).
>
>
It's a static method in junit.framework.Assert
So you'd need to call it Assert.assertTrue(...);
Does JUnit rely on it's own assertion mechanism to be used? What if you
use Nice's assert?
As you found out, the other difficulty is that JUnit expects to find
(static?) test* methods inside the class, and that's not how nicec
compiles them. It might in the future, especially for parameterless
methods like this.
Is it important for you to use JUnit? As far as I understand, this is a
very simple framework: find the testcases by reflexion, set them up,
run, present the results. Am I missing something?
I wrote a small tool, that is more convenient to use in Nice. I'll
describe it in
http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/UnitTesting
By the way, there is a page about development tools useful for Nice
programming:
http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/DevelopmentTools
Ifyou have some time, please visit:
http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/ToolsNeedingImprovements
and vote for the bug reports on Sun's JVM and Eclipse, so that Nice
supports becomes better!
Daniel
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click