Professional Documents
Culture Documents
Oosad Chapter 7 PDF
Oosad Chapter 7 PDF
Chapter 7
Object-Oriented Testing
Overview
Software development is a complex endeavor. You create a variety of artifacts
throughout a project, some of which you keep and some you do not. Regardless
of whether you keep the artifact, the reason why you create it is because it
adds some sort of value.
7.1 The Cost of Change
A critical concept that motivates testing is the cost of change. Figure 7.1
depicts the traditional cost of change curve for the single release of a project
following a serial (water fall) process. It shows the relative cost of addressing a
changed requirement, because it was either missed or misunderstood,
throughout the lifecycle. As you can see, the cost of fixing errors increases
exponentially the later they are detected in the development lifecycle because
the artifacts within a serial process build on each other. For example, if you
make a requirements error and find it during the requirements phase it is
relatively inexpensive to fix. You merely change a portion of your requirements
model.
review models and documents and therefore find and fix defects long
before they get into your code.
3. Test often and early. The potential for the cost of change to rise
exponentially motivates you to test as early as possible.
4. Testing builds confidence. Many people fear making a change to their
code because they are afraid that they will break it, but with a full test
suite in place if you do break something you know you will detect it and
then fix it.
5. Test to the amount of risk of the artifact. The riskier something is, the
more it needs to be reviewed and tested.
6. One test is worth a thousand opinions. You can tell me that your
application works, but until you show me the test results, I will not
believe you.
7. Testing is not about fixing things. Testing is about discovering defects.
7.3 Regression Testing
Regression testing is the act of ensuring that changes to an application have
not adversely affected existing functionality. Have you ever made a small
change to a program, and then put the program into production only to see it
fail because the small change affected another part of the program you had
completely forgotten about? Regression testing is all about avoiding problems
like this.
7.4 Quality Assurance
Quality assurance (QA) is the act of reviewing and auditing the project
deliverables and activities to verify that they comply with the applicable
standards, guidelines, and processes adopted by your organization.
Fundamentally, quality assurance attempts to answer the following questions:
"Are you building the right thing?" and "Are you building it the right way?"
A key concept in quality assurance is that quality is often in the eye of the
beholder, indicating many aspects exist to software quality, including the
following:
Does it meet the needs of its users?
Does it provide value to its stakeholders?
Does it follow relevant standards?
Is it easy to use by its intended users?
Is it reasonably free of defects?
Is it easy to maintain and to enhance?
How easy will it integrate into the current technical environment?
Quality assurance is critical to the success of a project and should be an
integral part of all project stages, but only when it is done in an effective and
efficient manner.
scenario testing is the acting out of scenarios. If the group you are
working with is new to the technique you may want to go through a few
practice rounds.
5. Act out the scenarios. As a group, the facilitator leads the SMEs through
the process of acting out the scenarios. The basic idea is the SMEs take
on the roles of the cards they were given, describing the business logic of
the responsibilities that support each use-case scenario. To indicate
which card is currently "processing," a soft, spongy ball is held by the
person with that card. Whenever a card must collaborate with another
one, the user holding the card throws the ball to the holder of the second
card. The ball helps the group to keep track of who is currently
describing the business logic and also helps to make the entire process a
little more interesting. You want to act the scenarios out so you gain a
better understanding of the business rules/logic of the system (the
scribes write this information down as the SMEs describe it) and find
missing or misunderstood responsibilities and classes.
6. Update the domain model. As the SMEs are working through the
scenarios, they will discover they are missing some responsibilities and,
sometimes, even some classes. Great! This is why they are acting out the
scenarios in the first place. When the group discovers the domain model
is missing some information, it should be updated immediately. Once all
the scenarios have been acted out, the group ends up with a robust
domain model. Now there is little chance of missing information
(assuming you generated a complete set of use-case scenarios) and there
is little chance of misunderstood information (the group has acted out
the scenarios, describing the exact business logic in detail).
7. Save the scenarios. Do not throw the scenarios away once you finish
acting them out. The scenarios are a good start at your user-acceptance
test plan and you will want them when you are documenting the
requirements for the next release of your system.
7.5.3 Prototype Reviews/Walkthroughs
The user interface (UI) of an application is the portion the user directly
interacts with: screens, reports, documentation, and your software support
staff. A user interface prototype is a user interface that has been "mocked up"
using a computer language or prototyping tool, but it does not yet implement
the full system functionality.
A prototype walkthrough is a testing process in which your users work through
a series of usage scenarios to verify that a user prototype meets their needs.
7.5.4 User-Interface Testing
UI testing is the verification that the UI follows the accepted standards chosen
by your organization and the UI meets the requirements defined for it. User-
interface testing is often referred to as graphical user interface (GUI) testing. UI
testing can be something as simple as verifying that your application "does the
right thing" when subjected to a defined set of user-interface events, such as
keyboard input, or something as complex as a usability study where human-
factors engineers verify that the software is intuitive and easy to use.
7.5.5 Model Reviews
A model review, also called a model walkthrough or a model inspection, is a
validation technique in which your modeling efforts are examined critically by a
group of your peers. The basic idea is that a group of qualified people, often
both technical staff and SMEs, get together in a room to evaluate a model or
document. The purpose of this evaluation is to determine whether the models
not only fulfill the demands of the user community but also are of sufficient
quality to be easy to develop, maintain, and enhance.
7.6 Testing Your Code
You have a wide variety of tools and techniques to test your source code. In
this section I discuss
Testing terminology;
Testing tools;
Traditional code testing techniques;
Object-oriented code testing techniques; and
Code inspections.
7.6.1 Testing Terminology
Let us start off with some terminology applicable to code testing, system testing
and user testing). To perform these types of testing you need to define, and
then run, a series of tests against your source code. A test case is a single test
that needs to be performed. If you discover that you need to document a test
case, you should describe
Its purpose;
The setup work you need to perform before running the test to put the
item you are testing into a known state;
The steps of the actual test; and
The expected results of the test.
7.6.2 Testing Tools
As you learned, regression testing is critical to your success. as an agile
developer. Many software developers use the xUnit family of open source tools,
such as JUnit and VBUnit to test their code. The advantage of these tools is
that they implement a testing framework with which you can regression test all
of your source code. Commercial testing tools, such Mercury Interactive), jTest ,
and Rational Suite Test Studio are also viable options. One or more testing
tools must be in your development toolkit.