3 ms·
As much as TDD irks me to think about when I'm in the middle of a program, it's a very useful thing. Its saved me from making countless mistakes. JUnit isn't
by speek 18y ago
As much as TDD irks me to think about when I'm in the middle of a program, it's a very useful thing.
Its saved me from making countless mistakes.
JUnit isn't good for beginners though, because you have to define an equals method for each class. Not only is that completely repetitive, but it is also very difficult for beginning programmers to write good tests. If you haven't been programming for very long, how do you know how to define equality? Do you consider two objects that have the same fields (only the fields you're testing) to be equal? Or are you checking whether or not two objects are the same (bit for bit in the stack)? What happens when you have super-classes that have less fields than their subclasses?
Anyway, one of my professors is working on a new tester for java (http://www.ccs.neu.edu/javalib/Tester/index.html http://www.ccs.neu.edu/javalib/Tester/index.html). It's very elegant; the syntax is very clean:
"public void testGresterThan(Tester t){
t.checkexpect(7 > 4, true);
}"