You are on page 1of 4

Principles of Object-Oriented

Testing
Object-oriented systems are built out of
Chapter 8
two or more interrelated objects
Determining the correctness of O-O
systems requires testing the methods
Testing that change or communicate the state of
an object
Testing methods in an object-oriented
system is similar to testing subprograms
in process-oriented systems

Definitions: Error and Fault Definitions: Failure


Error - refers to any discrepancy Failure - is the inability of a piece of
between an actual, measured value and software to perform according to its
a theoretical, predicted value. Error specifications. Failures are caused by
also refers to some human action that faults, but not all faults cause failures.
results in some sort of failure or fault in A piece of software has failed if its
the software actual behavior differs in any way from
Fault - is a condition that causes the its expected behavior
software to malfunction or fail

Test Plan Test Plan


A test plan specifies how we will If a test is to be accomplished by a
demonstrate that the software is free of series of smaller tests, the test
faults and behaves according to the specification describes the relationship
requirements specification between the smaller and the larger tests
A test plan breaks the testing process The test specification must describe the
into specific tests, addressing specific conditions that indicate when the test is
data items and values complete and a means for evaluating
Each test has a test specification that the results
documents the purpose of the test

1
Test Oracle Test Cases
A test case is a set of inputs to the
A test oracle is the set of predicted system
results for a set of tests, and is used to Successfully testing a system hinges on
determine the success of testing selecting representative test cases
Test oracles are extremely difficult to Poorly chosen test cases may fail to
create and are ideally created from the illuminate the faults in a system
requirements specification In most systems exhaustive testing is
impossible, so a white box or black box
testing strategy is typically selected

White Box Testing Black Box Testing


The tester uses knowledge of the The tester knows nothing about the
programming constructs to determine the test internal structure of the code
cases to use
Test cases are formulated based on
If one or more loops exist in a method, the
tester would wish to test the execution of this
expected output of methods
loop for 0, 1, max, and max + 1, where max Tester generates test cases to
represents a possible maximum number of represent all possible situations in order
iterations to ensure that the observed and
Similarly, conditions would be tested for true expected behavior is the same
and false

Unit Testing Integration Testing


The units comprising a system are individually The goal is to ensure that groups of
tested components work together as specified
The code is examined for faults in algorithms, in the requirements document
data and syntax Four kinds of integration tests exist
A set of test cases is formulated and input and Structure tests
the results are evaluated Functional tests
The module being tested should be reviewed Stress tests
in context of the requirements specification
Performance tests

2
System Testing Testing Steps
Determine what the test is supposed to
The goal is to ensure that the system measure
actually does what the customer Decide how to carry out the tests
expects it to do
Develop the test cases
Testing is carried out by customers Determine the expected results of each
mimicking real world activities test (test oracle)
Customers should also intentionally Execute the tests
enter erroneous values to determine the Compare results to the test oracle
system behavior in those instances

Special Issues for Testing Object-


Analysis of Test Results
Oriented Systems
The test analysis report documents Because object interaction is essential
testing and provides information that to O-O systems, integration testing must
allows a failure to be duplicated, found, be more extensive
and fixed
Inheritance makes testing more difficult
The test analysis report mentions the
sections of the requirements by requiring more contexts (all sub
specification, the implementation plan, classes) for testing an inherited module
the test plan, and connects these to
each test

Configuration Management Suggested Group Activity


Software systems often have multiple
versions or releases Divide into your software engineering
Configuration management is the process of teams
controlling development that produces Create a test plan: TestPlan.doc
multiple software systems
An evolutionary development approach often
results in multiple versions of the system
Regression testing is the process of retesting
elements of the system that were tested in a
previous version or release

3
Suggested Individual/Class
Activity
Discuss the following system failures:
TestingEX.doc

You might also like