August 2005
Beginner to intermediate
130 pages
2h 30m
English
JUnit is a regression testing framework written by Kent Beck and Erich Gamma. Since Erich is the project leader for Eclipse's Java toolkit, it's only natural that JUnit is well integrated into the IDE.
To try out unit testing in Eclipse, first create a project called Factorial containing a class called Factorial. Inside that class, create a factorial() method as follows:
public classFactorial {public static doublefactorial(intx) {if(x == 0)return1.0;returnx + factorial(x - 1); } }
If you notice the nasty little error in this code, ignore it for now. That's part of the demonstration!
Read now
Unlock full access