Chapter 9 Flashcards
logic error
a problem where the program compiles & executes without an obvious error but delivers wrong result
testing
an activity concerned with finding out whether a segment of code contains any errors
debugging
- comes after testing
- the attempt to pinpoint& fix the source of an error
unit testing
tests of the individual parts of an application, such as methods and classes
positive testing
the testing of cases that are expected to succeed
negative testing
testing of cases that we expect to fail
test automation
simplifies the process of regression testing
regression tests
- desirable to run whenever a change is made to software because further errors can be introduced when modifying software
- involves rerunning tests that have previously passed, to ensure the new version still passes them
- one of the easiest ways to automate regression tests is to write a program that acts as a test rig or test harness
JUnit
a popular testing framework to support organized unit testing and regression testing in Java
test class
- color is different from the ordinary classes in the diagram
- annotated as «unit test»
- attached to ordinary class (reference class) of the same name
- additional controls in the main window, below compile button
- right click menu has 3 new sections instead of list of constructors
assertion
an expression that states a condition that we expect to be true.
If the condition is false, we say that the assertion fails. this indicates an error in our program
fixture
a set of objects in a defined state that serves as a basis for unit tests
walkthrough
- an activity of working through a segment of code line by line while observing changes of state and other behavior of the application
disadvantages of print statements
- not practical to add print statements to every method in a class- only effective if the right methods have been annotated
- adding too many can lead to info overload. Print statements inside loops are particular source of this problem
- can be tedious to remove once their purpose is served
- they may be needed again after removing so frustrating to put back in