Lion-O wrote:
>> JUnit saves time - compared to writing your own test framework.
>
> Leading up to: why would you need an entire framework?
>
>
Re****ting, assertions, setup/teardown, to name a few.
To write two tests in JUnit:
public class MyTest extends TestCase {
public void testMyFirstTest() {
String foo = " foo ";
assertEqual("foo", foo.trim());
}
public void testMyOtherTest() {
String foo = "Hello world";
assertEquals("world", foo.substring(6));
}
}
Now, this is using older JUnit, there are things you can do with
annotations that make it even more powerful.
JUnit isn't a complex framework, but its useful and one less thing to
worry about.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>


|