Java Reference
In-Depth Information
CHAPTER 11
Debugging and Unit Testing
Debugging is a big part of software development. To effectively debug, you must be
able to “think” like a computer and dive into the code, deconstructing every step that
lead to the logic error that you're working to resolve. In the beginning of computer pro-
gramming, there weren't a lot of tools to help in debugging. Mostly, debugging involved
taking a look at your code and spotting inconsistencies; then resubmitting the code to be
compiled again. Today, every IDE offers the ability of using breakpoints and inspecting
memory variables, making it much easier to debug. Outside the IDE there are other tools
that help in daily debugging, building, and testing of your project; and these tools ensure
that your code is being continually tested for errors introduced when programming. In
this chapter, you explore the different tools that will help aid in debugging, analyzing,
and testing Java software.
This chapter covers some debugging and unit testing basics. You will learn how to
perform unit testing from the command-line or terminal using Apache Ant, along with
JUnit. You will also learn how to make use of the NetBeans Profiler, among other tools,
for profiling and monitoring your applications.
11-1. Understanding Exceptions
Problem
You caught and logged an exception, and you need to determine its cause.
Solution
Search WWH ::




Custom Search