Summary

In this chapter, we presented the basic of creating unit tests using Eclipse and JUnit. You saw how Eclipse is able to generate test method stubs and automate the execution of these methods by seamlessly integrating the JUnit. Moreover, we also gave an overview of the main JUnit features as, for example, the most commonly used annotations. Apart from unit tests, this chapter also briefly covered how to use the Java built-in Eclipse debugger.

Keep in mind that there are some testing-related topics which we did not cover in this chapter. Earlier on in the chapter, we mentioned that tests need to be independent from each other so that you can re-run them in any order that you wish. Sometimes, however, objects interact with other objects, which makes the creation of independent test methods more complex. In a unit test, when there are objects that may compromise the independence of the test or whose complexity may make the use of the real objects impractical, mock objects are used. These mock objects simulate the behavior of real objects. Luckily, there are frameworks that automate most of the process involved in creating mock objects. We encourage the interested reader to read about Mockito (http://code.google.com/p/mockito/).

Apart from a good set of test methods, whenever you set out to develop a reasonable-sized application, you need to have a back-up strategy. Usually, for code projects, this strategy includes using a version control program. A program that keeps track of different versions of programs is called version-control system. The next chapter describes an example of version-control system, namely, Git.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset