O'Reilly logo

Java® and Mac OS® X by T. Gene Davis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. JUnit on OS X

JUnit is a Java test-driven development (TDD) framework. Traditional software development starts with some sort of requirement documents, followed by massive amounts of programming, and finishes off with some sort of manual or automated testing. Test-driven development starts with requirements, followed by the writing of automated tests, and concludes with the creation of the computer program that allows the previously written tests to pass.

The mental reordering that test-driven development requires can make you dizzy at first. It is not for every company. However, test-driven development leads to well-thought-out programs that are easier to maintain than the spaghetti that result from no planning.

JUnit also works for regression testing and more casual testing efforts. Create regression tests by finding bugs in your code. Next, create a test that fails because of the bug. Finally, fix the program, and the test passes. Leave the tests in place, and run these tests frequently to ensure that the bugs do not reappear.

Regression testing is great for projects with lots of developers working on the same code. If the project is managed without clear definitions as to who owns and makes changes to specific code, a programmer may fix a bug that creates other bugs. When another programmer comes along and fixes those other bugs, the programmer may introduce the original bug while ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required