Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The "HowToDevelopUnitTests" page has been changed by LukeLu. The comment on this change is: Let unit tests be "unit" tests. http://wiki.apache.org/hadoop/HowToDevelopUnitTests?action=diff&rev1=6&rev2=7 -------------------------------------------------- This leaves less code around (lower maintenance costs), and ensures that any failure gets reported with a full stack trace. + == Let Unit Tests be "Unit" tests == + + Avoid starting servers (including Jetty and Mini{DFS|MR}Clusters) in '''unit''' tests, as they take tens of seconds to start for each test (HDFS and Map``Reduce tests already take many hours mostly due to these servers starts). Use them only in cross component '''functional''' or '''integration''' (system) tests (cf. [[https://issues.apache.org/jira/browse/HADOOP-6399|HADOOP-6399]]). Try to use one of the lighter weight [[http://www.martinfowler.com/bliki/TestDouble.html|test doubles]] for collaborating components for the component under test. Hadoop has adopted the [[http://mockito.googlecode.com/svn/tags/latest/javadoc/org/mockito/Mockito.html|Mockito]] library for easy mock and stub creation. + == References == * [[http://code.google.com/p/t2framework/wiki/JUnitQuickTutorial|Quick tutorial]] on the JUnit website.