Part IV Testing Flashcards
What is a test case specification?
A document describing the test case of a particular test
Contains:
a) Test case specification identifier
b) Test items
c) Input specifications
d) Output specifications
e) Environmental needs
f) Special procedural requirements
g) Intercase dependencies
What does a test procedure specification contain?
a) Test procedure specification identifier
b) Purpose
c) Special requirements
d) Procedure steps
What are XUnit family testing frameworks?
Frameworks that make specifying tests, executing tests, and reporting the results easier -> by automation
Why is it important to automate tests?
Manually running test scripts is tedious, error prone, and expensive
What is the difference between JUnit 3.8 and JUnit 4?
JUnit4 uses annotations (e.g. @Test) to identify test cases rather than reflection in JUnit 3.8
JUnit4 offers support for pre-test (set up) and post-test (tear down) management
How do you describe a test?
What is the IUT (Implementation under test)
What is the pretest state
What are the inputs (test case values and other inputs)
What is the expected state
What are some problems with test automation?
Certain artifact testing cannot be automated (testing user interfaces)
Hard to exercise potential failure situations (e.g. timing problems in real-time or concurrent software)
Some designs cannot be easily automatically tested
A lot of work needed to support traceability - relationship between tests executed and client’s requirements
What defines a good test?
The purpose of testing is to detect the presence of faults
Hence, the higher the probability of causing a failure (assuming a fault exists), the better the quality of the test
The quality of the overall test suite is more important than the quality of the individual tests
What is statement coverage?
The number of statements executed by all tests divided by total number of statements
The intuition is that each line may contain a fault and so the more lines that are executed the higher chance of causing a failure
It is a measure of test suite quality
Is 100% statement coverage always possible?
No, code may contain dead code (unreachable code)
What is white box testing?
Performing tests based on how the component is implemented (focus on the artifact e.g. code)
Decide on tests based on the code itself
Not good at detecting faults related to requirements
What is black box testing?
Performing tests based on what the component is supposed to do (focus on quality attribute)
Decide on tests based on requirements independent of the code
Not good at detecting faults in implementation decisions
What is a control flow graph?
DIrected graph used to model the control flow of a program
Vertex = statement
Edge = (A,B) if control flows from statement A to B
We are interested in the number of different ways control flow can occur through the code
What is a basic block?
A sequence of statements that have the following properties:
First statement is always the first statement executed (one entry point)
Only last statement can cause the program to begin executing code in a different basic block (one exit point)
ie. If first statement is executed then all statements in the basic block are executed
Can be used to simply control flow graphs
What is a test requirement?
A specific element of a software artifact that a test case must satisfy
e.g. statement A must be executed
What is a coverage criterion?
A rule or set of rules that impose test requirements on a test suite
e.g. the statement executed criterion imposes, for every statement x, the test requirement that statement x must be executed
What is coverage level?
The ratio of the number of test requirements satisfied by the test suite to the total number of test requirements
What is a test path?
Sequence of vertices in the CFG such that the first is the entry vertex, the last is the exit vertex and every pair of adjacent vertices is connected by an edge in the CFG
ie potential path through code
What is path coverage?
Coverage criterion - any test path
Intuition - any execution flow is represented by a path, so any missed paths may correspond to incorrect execution
What is condition coverage?
Given a compound expression (e.g. if ( a > 0 || b > 0) ) in order to detect all possible faults, all combination of sub-expressions must be tested
Can be modelled by breaking the compound expression into more if statements
What is the difference between a failure and an error according to JUnit?
Failure -> the expected result specified by human tester was not what JUnit observed (typically a failed assertion)
Error -> JUnit was unable to complete the test. Typically some exception that is thrown and not caught
What is a path vs test path?
A path is a CFG sequence of vertices
A test path is a path where the first vertex is the entry vertex and the last vertex is the exit vertex