Test Classes and TimexTestCase


*Test Classes and TimexTestCase

Most of our earlier *Test classes looked something like the following code snippet from our original TimesheetManagerTest class:

public class TimesheetManagerTest extends TestCase {     TimesheetManager timesheetManager = new TimesheetManager();     public static void main(String args[])


Now, instead of extending the JUnit TestCase class directly, we extend the TimexTestCase class (in the timex2/ directory), as shown next:

public class TimesheetManagerTest extends TimexTestCase {     public static void main(String args[])


The benefit of this approach is that we can put all the fixture code in a parent class (such as TimexTestCase), so the test subclasses can focus on the unit tests versus fixture code (visit junit.org for details on fixture code).



Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net