Unit 5 Study Guide and Review: Memory Management and Testing
5a. Define test cases and coverage analysis
- What are the types of unit tests and how they are used?
- What are the different roles in test development?
You should make sure that each and every branch of decisions are reached during your test cases to ensure that all possible outcomes are tested. The goal is to try and see if you can get your program to crash, so that if it does, you can fix it. Test for extreme cases, user error, bad input and any other possibility. When developing test cases, many people play a role in this process, as it is essential that there be an understanding of how users might use the software. For more information on unit tests, refer to this page.
5b. Use debugging tools
- What are the steps to the debugging process?
- What are the shortcut keys to step through your coding?
Logical errors are often very difficult to figure out. Using the debugging tools that are build into your IDE, in this case, Eclipse, allows you to track your data values and see what is happening behind the scenes. Think of it to a backstage pass to the code. Running the code in debug mode allows you to review each line of code, and the resulting data values. For more information on debugging tools, refer to this tutorial.
5c. Use memory management
- How do you write a method that deallocates memory from a class?
- How do you release a pointer from memory?
Whenever you instantiate a class, you are reserving memory space, once you are no longer using that class, it is important that you remove the instance from memory, freeing up memory space for use later. The same practice should be done with the use of pointers, removing the pointer allocation from memory. For more information on memory management, refer to these slides.
Unit 5 Vocabulary
This vocabulary list includes terms that might help you with the review items above and some terms you should be familiar with to be successful in completing the final exam for the course.
Try to think of the reason why each term is included.
- Breakpoint
- Coverage analysis
- Dangling pointer
- Debug mode
- Debug perspective
- Debugging
- Debugging tools
- Destructor
- Detail Formatter
- Heap
- Memory leak
- Memory management
- Stack
- Stop point
- Test case
- Toggle breakpoint
- Unit test
- Variables view
- Watchpoint