Testing Introduction
Testing is a critical component of the software development process. The goals of testing include ensuring your application produces the desired output and handles errors gracefully. Checking that your program performs correctly by providing expected and correct input is only part of the process — it’s important to test your system with incorrect and erroneous input, and to stress test it. Failing to consider these latter cases can cause you to overlook bugs that may be in your code.
Software defects can sometimes just be amusing. If you try to watch a video with an age restriction from Hulu, but the video is streamed through a different website, it is possible to successfully enter February 30 as your birthday. But, bugs can also be costly. In 2002, NIST reported that software bugs cost nearly $60 billion. They can also cost human lives — the Patriot Missile system had a floating point round-off error that got worse over time, and since the appropriate endurance tests weren’t carried out, the Patriot's ability to shoot down other missiles was severely compromised.
There are many different levels of testing:
- Unit testing involves testing individual units of code. Tests are typically carried out against individual functions, methods or classes independently of each other.
- Integration testing verifies that interfaces between a system's components work as they should. This level of testing ensures that the modules within a system can interact with each other.
- System testing tests the entire system to verify that it meets the requirements.
There are several approaches that refer to the visibility of the code being tested. White box testing is where the tester knows about the inner workings of the software being tested. On the other hand, black box testing involves just the opposite — the tester knows the functionality of the system, but not how that functionality is implemented. In today’s lab, you will be black box testing a class that has already been written for you.