Você está na página 1de 44

A Publication

Po
PR -Dep nin
BE TIC ym
st Tu
AC lo g
ST ES en
: t
VOLUME 5 • ISSUE 9 • SEPTEMBER 2008 • $8.95 • www.stpmag.com

Earn Yo
ur Chops T
esting
Micros
of t App
s
Tools For
page 1
4

.NET You he
Didn’t Know a
T
nd yed
You Had Bui Q A le Pla facts
F or ld a Ro Arti
Stu Fram By
Dat rd y,
a-A Rep ework
pp
Tes etitive
ting
EG ISTER R
R NE FO
ONLI DMISSION!
FREE A TPCON.COM
S
WWW.

September 24-26, 2008


Marriott Copley Place, Boston, MA
www.stpcon.com

FALL
IS IT CRAZY TO WANT TO MEET
THE MAKERS OF THE LATEST
SOFTWARE TESTING TOOLS?
WE DON’T THINK SO, which is why we’ve gathered
the industry’s TOP COMPANIES in our Exhibit Hall!

Learn about their new products and features, test them


out, and talk to the experts who built them.

Exhibit Hall Hours:


Thursday, September 25 / 3:00 pm – 7:00 pm
Friday, September 26 / 9:30 am – 1:15 pm

COME AND GET CRAZY WITH US !


HEAR WHAT ATTENDEES HAVE TO SAY ABOUT STPCON! CHECK OUT A VIDEO FROM
THE LAST EVENT AT WWW.STPCON.COM
You d o the m a th
6gZ ndj gZVaan hVk^c\ bdcZn
l^i] D[[h]dgZ IZhi^c\4
FjVa^IZhi Dch]dgZ IZhi^c\ Hdaji^dch Ä
Ldg`^c\ id\Zi]Zg l^i] ndj id YZa^kZg fjVa^in!
dc i^bZ VcY dc WjY\Zi#

;dg dkZg &% nZVgh! FjVa^IZhi ]Vh WZZc YZY^XViZY id YZa^kZg^c\ hjeZg^dg F6 VcY
iZhi^c\ hZgk^XZh id <adWVa [dgijcZ *%% XdbeVc^Zh hjX] Vh B^Xgdhd[i! >ciZa! <:!
KZg^odc! I"BdW^aZ! BdidgdaV! H^ZbZch VcY H6E#
FjVa^IZhi egdbdiZh \adWVa hiVcYVgYh hjX] Vh IE> VcY @9I dc V adXVa WVh^h!
ldg`^c\ XadhZan l^i] ndjg iZVb id ZchjgZ ndj YZa^kZg dc i^bZ VcY dc WjY\Zi#
L^i] V egdkZc gZXdgY d[ ZmXZaaZcXZ ^c egVXi^XZ! lZ Wg^c\ `cdlaZY\Z VcY
ZmeZg^ZcXZ id ndj " Z^i]Zg dch^iZ dg i]gdj\] dcZ d[ FjVa^IZhiÉh Dch]dgZ F6
8ZciZgh d[ :mXZaaZcXZ#

Id aZVgc bdgZ! XdbZ k^h^i jh Vi HIE Ä Hd[ilVgZ IZhi  EZg[dgbVcXZ


Xdc[ZgZcXZ ^c 7dhidc! Wddi]  *%& dg k^h^i djg lZWh^iZ Vi
lll#FjVa^IZhi"^ci#Xdb
VOLUME 5 • ISSUE 9 • SEPTEMBER 2008

Contents A Publication

14
COV ER STORY
Disciplines for Attacking Apps
Running on the Microsoft Stack
While Windows, .NET, IIS and SQL Server might themselves seem stable,
once one fails, the rest can shatter like cement blocks. By Pete Jenney

.NET Tools You


24 Already Have
Learn how to simplify debugging by
extracting diagnostics and data from
event logs, using some of the many class-
es included within the .NET Framework
Class Library.
By Stephen Teilhet

A Sturdy Data
Depar t ments
31 Framework For
Repetitive Testing
7 • Editorial
Why the AOL development team takes a
different tack on testing.

8 • Contributors
Here’s a test harness that your team Get to know this month’s experts and the
can build that will simplify manipula- best practices they preach.
tion and maintenance of your test data.
By Vladimir Belorusets 9 • Feedback
The Role Of
37 Artifacts in QA
It’s your chance to tell us where to go.

11 • Out of the Box


News and products for testers.
Bring the use of artifact traceability to
your organization and use it as a QA 13 • ST&Pedia
management tool. Industry lingo that gets you up to speed.
By Venkat Moncompu and
Sreeram Gopalakrishnan 40 • Best Practices
One of the .NET results of post-deployment
enterprise testing. By Joel Shore

42 • Future Test
A trainer of Microsoft testers breaks out of
the black box. By Bj Rollison

SEPTEMBER 2008 www.stpmag.com • 5


4AKE THE
HANDCUFFS OFF
QUALITY ASSURANCE
Empirix gives you the freedom to test your way.
Tired of being held captive by proprietary scripting? Empirix offers a suite of
testing solutions that allow you to take your QA initiatives wherever you like.
Download our white paper, “Lowering Switching Costs for Load Testing
Software,” and let Empirix set you free.

www.empirix.com/freedom
Ed Notes

Editor
VOLUME 5 • ISSUE 9 • SEPTEMBER 2008

Edward J. Correia
EDITORIAL
Editorial Director
Alan Zeichick
NBC and China’s
Top Coders
+1-631-421-4158 x100 +1-650-359-4763
ecorreia@bzmedia.com alan@bzmedia.com

Copy Desk Contributing Editors


Adam LoBelia Matt Heusser
Diana Scheben Chris McMahon
Joel Shore
As surely as the Summer based on the quality of
ART & PRODUCTION Games come every four their code. “Check out the
Art Director years, I also find myself top standings among the
LuAnn T. Palazzo complaining about the community for developer
lpalazzo@bzmedia.com
U.S.-centric television cov- competitions. You’ll notice
SALES & MARKETING erage. Most frustrating are that every single one of the
Publisher choices by the network to top ten ranked developers
Ted Bahr provide no coverage at all is from China.”
+1-631-421-4158 x101
ted@bzmedia.com
of certain events or match- Developers (as well as
es, such as soccer and designers and testers)
Associate Publisher weightlifting. Granted, Am- stand to earn big bucks
David Karp Edward J. Correia
+1-631-421-4158 x102
erica’s soccer teams don’t channeled to them from
dkarp@bzmedia.com usually advance into the final rounds, companies using TopCoder as an out-
but fans of the sport still might want to source development service provider.
Advertising Traffic Reprints
Liz Franklin Lisa Abelson
watch Brazil vs. Germany. And just One such company is AOL’s products
+1-631-421-4158 x103 +1-516-379-7097 because the U.S. has only seven athletes division, which uses TopCoder for
lfranklin@bzmedia.com labelson@bzmedia.com snatching or doing the clean and jerk some of its customer-facing Web appli-
doesn’t mean Americans aren’t interest- cations, such as those of AOL Mail. Nic
List Services Accounting
Lisa Fiske Viena Ludewig ed in weightlifting. Perez, technical director at AOL,
+1-631-479-2977 +1-631-421-4158 x110 But this Olympics is different, and praises Top Coder for its app-testing
lfiske@bzmedia.com vludewig@bzmedia.com I’ll be the first to give NBC its due. capabilities. “At the very start, there’s a
Not for its television coverage does QA plan. We think of it as an integra-
READER SERVICE
Director of Circulation Customer Service/
the network deserve praise, but for tion plan for how they’re going to
Agnes Vanek Subscriptions NBColympics.com, its terrific Olympics attack the component.” The plans are
+1-631-443-4158 +1-847-763-9692 Web site. Thanks to video streaming, reviewed and signed off on by AOL.
avanek@bzmedia.com stpmag@halldata.com
viewers were allowed to choose which “Then we’re quiet as they go do it.
live events to watch as they happened. When we get the final code, we just
Cover Photograph by Tom Schmucker
An enhanced viewer (based on look at the test cases.” Perez said the
Microsoft’s Silverlight) permitted up to quality is so good, he has come to rely
four streams at any one time; three in on TopCoder’s quality reviewers. “Be-
thumbnail boxes alongside one larger cause we’ve done so many components
16x9 box with sound. There were no we don’t see the need [to perform fur-
commentators, but live mics at the ther testing]. It meets our require-
President BZ Media LLC events kept you feeling connected as ments.”
Ted Bahr 7 High Street, Suite 407 you heard shouts from coaches, cheers
Huntington, NY 11743
Executive Vice President
+1-631-421-4158 from the crowd and splashes from the Best Practices Redux
Alan Zeichick
fax +1-631-421-4130 “Water Cube.” This month I am pleased to introduce
www.bzmedia.com
info@bzmedia.com
And just as the “Bird’s Nest” and Joel Shore, who takes over the Best
other Olympic arenas sprouted from Practices column. He replaces Geoff
the ground like winter wheat around Koch, who ably contributed since
Software Test & Performance (ISSN- #1548-3460) is Beijing, so too has a crop of Chinese before my time here and has moved
published monthly by BZ Media LLC, 7 High Street,
Suite 407, Huntington, NY, 11743. Periodicals postage coders risen through the ranks of appli- on to pursue a career in marketing.
paid at Huntington, NY and additional offices.
cation developers in China’s emerging Joel holds a special place in my per-
Software Test & Performance is a registered trade-
mark of BZ Media LLC. All contents copyrighted tech sector. “The Chinese, according to sonal history. As director of the CRN
2008 BZ Media LLC. All rights reserved. The price TopCoder’s software development com- Labs in 1995, he hired me as an edito-
of a one year subscription is US $49.95, $69.95 in
Canada, $99.95 elsewhere. petitions, are producing the top quality rial assistant for the labs, my first full-
POSTMASTER: Send changes of address to Software developers,” said Nick Schultz, a time editorial job. He is obviously a
Test & Performance, PO Box 2169, Skokie, IL 60076.
Software Test & Performance Subscribers Services spokesman for TopCoder (www.topcoder man of great foresight and vision. I am
may be reached at stpmag@halldata.com or by

ST&P. ý
calling 1-847-763-9692.
.com), which has built a market in delighted to have him writing for
which developers compete for prizes

SEPTEMBER 2008 www.stpmag.com • 7


Contributors
PETER JENNEY is a 20-year veteran of
software testing, during which time he
has held positions with Rational,
Dataware, Ipswitch and Legato. In his
current role as VP of products at risk
assessment consultancy Security
Innovation, he directs the company’s
commercial technology.
In our lead feature, Pete takes apart
the Microsoft stack to its component
parts, analyzing their interactions and
the impact of each on application stability. Turn to page 14.
STEPHEN TEILHET has been working
with the .NET platform since the pre-
alpha version of .NET 1.0. He co-
authored C# 3.0 Cookbook, Third
Edition, (O’Reilly, 2008) with Jay
Hilyard. He currently works for Ounce
Labs enhancing the company’s static
code analysis tools.
Beginning on page 24, Stephen
explains how—using tools included with
the .NET framework—you can simpli-
fy QA through analysis of event logs and debugging displays.

Certified by American Software Test-


ing Qualifications Board, VLADIMIR
BELORUSETS is an SQA manager at
Xerox, and is responsible for the qual-
ity of its enterprise content manage-
ment applications.
Vladimir explains his framework
for storing and reusing test data devel-
oped during more than two decades
of software development, test automa-
tion, test management, and software
engineering experience. Turn to page 31.

VENKAT MONCOMPU (right) and


SREERAM GOPALAKRISHNAN are
project managers at Intellisys Tech-
nology, an international IT services
consultancy. Venkat has a master’s
degree in engineering and more than
12 years in the IT industry as a devel-
oper, designer, business analyst and
testing coor-
dinator.
Sreeram
has a master’s degree in business
administration, is a certified PMP
and has 12 years of experience as a
QA analyst, business analyst and prac-
tice lead. Beginning on page 37, they
explain how traceability of artifacts
used in testing and development can
be used to improve quality.

TO CONTACT AN AUTHOR, please send e-mail to feedback@bzmedia.com.

8 • Software Test & Performance SEPTEMBER 2008


Feedback

Having been in QA for over 10 years, and


DOWN WILL COME SOFTWARE being familiar with many of the offerings
evaluated by Forrester, I think it'd be illus-
Regarding “Software Is Deployed, Bugs and All” (Test & QA Report, July 29, 2008),
I'm a code writer, AKA senior programmer. There would not be any bugs if the com- trative to take a peek under the covers at
panies were not in such a hurry to secure their market share. Plus there are CASE the Wave report in one of your future write-
TOOLS that can check and double-check the effectiveness of any program to see if it ups. Looking through their criteria, I find
scales (WORKS) or not.Then you have compilers that are written by programmers that a lot of it to be rather uninsightful (e.g. ,
don't catch the bugs before the software is deployed (HITS THE STORES). the ability to capture environment variable
info automatically is a key aspect of Result
And as far as the CASE TOOLS are reporting? I'd have to say that isn't one of
concerned, they are expensive for a jun- my key business needs with regard to
ior programmer or an independent results or even with regard to trou-
writer (freelance).The BIG companies bleshooting app and test issues!).
have really no excuse; they can afford Similarly, I find that the inclusion of
the CASE TOOLS. If [they] followed the flow chart to the letter it would not happen a "Strategy" category as part of the numer-
as much…that's why you need an error checker. Most [errors] are syntax errors any- ic rating often ends up being rather mis-
way. [If] your compiler does not come with one then you'll have to acquire a program leading. In fact, the first thing I did with
specifically for that task.They don't call me compuman2153 for nothing. the 2008 report was to set the strategy cat-
egory to 0% and the current offering to
K.J. Robinson 100%. When I did that, it became rather
clear that Empirix and Borland fare
WHAT’S YOUR FUNCTION exciting place to be, and I think you are notably poorer and IBM somewhat worse.
(TESTER)? doing your readership a disservice by Interestingly, HP and Compuware fared
Regarding “Which Functional Testers Do ignoring this area. better. Ultimately, despite some of the
the Best Job?' (Test & QA Report, July 15, Scott Addington underlying criteria being suspect, the cur-
2008), I have read with interest your arti- Original Software rent offering is and should be the focal
cle on which functional testers do the point of any evaluation (futures are vapor
best job. It was the last line of your arti- I am doing a search for good QA test IMO until they're in beta). The strategy
cle that saddened me, however; you seem tools for a department that I have recent- part is something that each evaluator
to be jumping from the goliaths of the ly taken over. Here is a good website with should press the vendor with directly
industry straight to open source with no a broad list of QA test tools; many are (when assessing their software), rather
consideration for the smaller companies open source: than relying on a third party.
that compete so well against the big guns http://www.softwareqatest.com/qat In any way, I'd love to hear a reality
of the industry. weba .html–this page is for website testing check on the Wave!
Obviously the heavyweight corpora- tools. There are other pages at this site. I “Testing Guru”
tions such as HP/IBM/Compuware and am taking a deeper look at OpenSTA,
Borland dominate this area; however I which is open source. I have a subordi- WAVING AT OPEN SOURCE
do think it is a mistake to forget the nate looking at TestComplete Enterprise Regarding “Functional Testing Tools, the
smaller niche players such as Original ($2k per seat, not open, but COM based Open-Source Wave” (Test & QA Report,
Software, Parasoft, Worksoft, etc., as and extensible). Another subordinate is July 15, 2008), my organization is using
more often than not, it is in these com- looking into a C# web-crawler to see if we AutoIt [http://www.autoitscript.com
panies where the real innovation within can integrate testing into it. /autoit3/] for our .NET project. How
the industry is happening. Although I BTW, thanks for the lead on pywin- does this compare to the other open-
can only talk for Original Software, some auto; we will check that one out also. source tools[?] For me, I have to make
of the innovations, such as data extrac- Looking forward to your next article, changes all of the time. [I am] looking
tion, data scrambling, self-healing scripts John Bond for a tool [that] adjusts to any changes in
and the advance in assisted manual test- a Windows Form application where the
ing, cannot be found in the solutions of I am currently evaluating Automated UI is changing but the object[s] are not!
HP/IBM etc. We are growing at a pace QA's TestComplete for automated test- Thanks.
that is far outstripping the market growth ing of our Delphi applications. Do you Charles Bytheway
rate, and we are actively taking customers have any information on how Test
from the big guys. I am sure this story Complete stacks up? BTW, your reports FEEDBACK: Letters should include the writer’s
is the same with other test software ven- are a life saver to me. I am new to the name, city, state, company affiliation, e-mail
dors of a similar size and agility to testing business, and I need all the help address and daytime phone number. Send your
Original Software. I can get. thoughts to feedback@bzmedia.com. Letters
become the property of BZ Media and may be
It is at the smaller end of the industry Thanks.
edited for space and style.
where innovation is happening. It is an Ed Bosgra

SEPTEMBER 2008 www.stpmag.com • 9


Out of the Box

Update .NET Apps, Not the Framework


Postbuild applications perform as well as
those running in the .NET Framework as nor-
mal, according to the company.

USB drives or any other available method.


“Postbuild is primarily designed for use
in deploying applications into production
environments,” said Xenocode CEO Kenji
Obata via e-mail. It integrates directly with
Visual Studio and includes a scriptable
command-line interface. The addition to
application footprint is minimal, he said.
When Microsoft updates its framework
with features developers would like to take
advantage of, “the software publisher val-
idates the application on the new runtime
and then rebuilds and updates the pack-
aged application,” Obata said. This minor
Xenocode, which makes virtualization Windows Presentation Foundation and inconvenience is offset by the benefit of
and obfuscation tools, in early August was the LINQ .NET extensions for native-lan- deploying applications bundled with a
set to begin shipping an update to guage queries. specific version of the .NET runtime,
Postbuild 2008 for .NET, which enables Among the benefits of the tool are the “insulating the application against poten-
developers to deploy .NET applications ability to package and distribute applica- tial failures due to execution of the appli-
to systems that do not have the .NET tions, dependencies, components, DLLs, cation on an untested forward version of
framework installed or have a mismatched runtimes and services as a single exe- the framework,” he said.
version. The update adds support for cutable. Apps can be sent via e-mail, direct Pricing starts at US$1599 for five
.NET 3.0 and 3.5, Visual Studio 2008, the file transfer, removable media such as developers.

Automated Import
Of Virtual Environs
Test-tools maker StackSafe in early August released an update
to Test Center, adding the ability to automatically import virtu-
alized environments and their components for staging, testing,
analysis and reporting, either alone or in combination with phys-
ical systems.
Introduced in January, Test Center employs virtualization
technology to give IT operations teams an easy way to simulate
multi-tiered systems and applications for testing and perform-
ance tuning, according to company claims.
As before, copies of imported environments are introduced
into a working infrastructure stack that simulates the produc-
tion configuration, enabling production-safe changes, regres-
sion testing, patch testing, security and risk assessment, diag-
nostics and root-cause analysis, emergency change testing, appli-
cation assembly and validation, and compliance reporting, the
company says. Test Center now automates VMware component imports.
Test Center benefits test teams, according to claims, by pro-
viding a “broad view of the entire IT operations infrastructure,” components such as databases, mainframes and other compo-
enabling testing across physical machines running Linux and nents that cannot yet be virtualized. The update is free to cur-
Windows, virtual machines set up with VMware and external rent licensees.

SEPTEMBER 2008 www.stpmag.com • 11


includes an undisclosed financial con- or less supplanting prior requests for
BusyBox Creators Sue sideration for the plaintiffs. more and more power. “[The] develop-
Extreme Networks ers’ first question is now, ‘This is my power
budget; how can TI help me do more with
Erik Anderson and Rob Landley, cre-
ators of the BusyBox toolset for
OpenMake Meister it?’ ” That’s according to Gene Fritz, a
resource-constrained Linux and Unix Does the Mash (up) principal fellow at TI. The answer, he said,
systems, in July filed another GPL is simple: “Decades of experience allow TI
With the recent release of Meister 7.2,
enforcement lawsuit for copyright to cut power consumption, improve ease-
OpenMake Software adds support for
infringement. of-use and drive performance within its
cross-platform builds within Microsoft’s
With the help of the Software architectures through better process tech-
Visual Studio, can “mash up” such builds
Freedom Law Center, the action is nology, peripheral integration, parallel
with those performed in Eclipse and oth-
against Extreme Networks Inc., a maker processing, analog, connectivity, and
er IDEs, and offers features to simplify the
of high-performance network switches power management software and tools.”
processing of continuous integration used
and other connectivity and communi- The results is a series of about 15
in many agile processes, the company said.
cations gear. Four previous cases result- new devices in four product lines to be
The release also enhances Meister’s
ed in out-of-court settlements in favor of released over the coming year that it
Management Control Console, a Web-
Anderson and Landley. In those cases, claims will increase battery life to days
based portal that the company says per-
defendants were ordered to distribute and weeks without sacrificing applica-
mits QA engineers, production control
source code in compliance with the GPL tion performance.
staff and other non-developers to have
v2. They’re also looking for damages and Aimed at audio, medical and industri-
control and oversight of builds. The tool
litigation costs. al applications needing a high-accuracy
now includes extended reporting using
According to the five-part complaint, floating point unit is the 674x DSP, with
the PostgreSQL. “Simplifying build com-
which was filed July 17 in the United TI says consumes one-third the power of
plexity is the no. 1 requirement we hear
States District Court in New York, a judg- its rivals. In sleep mode, it sips as little as
from developers,” said OpenMake CTO
ment is sought that Extreme Networks 6 mW of power, according to claims, and
Steve Taylor. “Our Management Console
be immediately “enjoined and re- 420 mW in active mode. Using about half
[provides] a push-button process for exe-
strained from copying, modifying, dis- the power (415 mW) of existing chips in
cuting and viewing build results from any-
tributing or making any other infring- the line is the 640x DSP, which TI says is
where in the world.”
ing use of Plaintiff’s software.” Also intended for software-defined radio and
The news comes on the heels of the May
sought is that Extreme “account other industrial instrumentation. It’s
1 release of Meister 7.0, which allowed
for and disgorge to Plaintiffs all planned for early 2009.
testers to expose the build “forensics” and
profits derived by Defendant from its Planned in the same time frame is
links to production binaries, which in turn
unlawful acts.” the latest in TI’s ARM-based application
permit root cause analysis back to the
“We attempted to negotiate with processor/DSP series, the OMAP L1x. It
offending source code. Beginning with ver-
Extreme Networks, but they ultimately will run Linux or TI’s DSP/BIOS real-
sion 7, the tool now links with a central
ignored us,” said Aaron Williamson, time kernel and is pin-for-pin compati-
knowledge base containing build-to-release
SFLC counsel. “Like too many other ble with devices in the 674x and 640x
information, connecting developers with
companies we have contacted, they chips. Power consumption in active
production results, and giving test teams
treated GPL compliance as an after- mode is rated at 435 mW.
better traceability of failed builds.
thought. That is not acceptable to us or For maximum battery life, develop-
our clients.” ers should look to the 550x, which uses
BusyBox in late July agreed to end its
lawsuit against Super Micro Computer,
TI’s Low Power Chips just 6.8 uW in deep sleep and 46 mW in
active mode. That’s half the power of
which manufactures and distributes com- Save Battery Life, Not TI’s C5000-series chips, and is suited for
puters and PC components. In exchange portable music recording, noise-reduc-
for dismissing the suit, “Super Micro has
The Planet tion headphones and multi-parameter
agreed to appoint an Open Source The low-power chips are a series of medical devices. The 550x includes
Compliance Officer within its organiza- application processors and digital signal large on-chip memory and an opti-
tion to monitor and ensure GPL com- processors announced in July by Texas mized FFT coprocessor. Availability is
pliance, to publish the complete and cor- Instruments, they consume significantly scheduled for early 2009.
responding source code for the version less power than their predecessors and Prices have been disclosed only for
of BusyBox it previously distributed, and prolong battery life of the devices built the 674x, which will be sampling before
to undertake substantial efforts to notify around them. The word “green” was the end of this year. In quantities of 100,
previous recipients of BusyBox from nowhere to be found. pricing will start at less than US$9.
Super Micro of their rights to the soft- Device designers using TI processors
Send product announcements to
ware under the GPL,” according to an have been asking the chip-maker for
stpnews@bzmedia.com
SFLC news release. The settlement also products that consume less power, more
SEPTEMBER 2008 www.stpmag.com • 12
ST&Pedia
Translating the jargon of testing into plain English

MS Terms of Endearment
The first day on the job at a Microsoft shop, of simultaneous connections. Developers typi-
you might hear something like this: “The cally write programs in C# or VB and connect
graphic designers are using Expression Web to SQL Server via ADO.NET.
and Silverlight, but the developers will just
take the HTML and put it in ASP, which we’ll TEAM FOUNDATION SERVER (TFS) /
test with Watir. Of course, we all collaborate A collaboration tool for the entire develop-
with VSTS.” ment team that includes version control,
“Er, I’m sorry, what?” might be your feeble Matt Heusser and reporting, analytics, and process management.
response, unless you’ve read this issue of Chris McMahon
ST&Pedia. The Microsoft Technology stack is VISUAL BASIC .NET (VB.NET) / The
a complex and sophisticated environment. .NET version of Visual Basic, an easy-to-use
Having a knowledge of this environment—
even a surface knowledge—can make you a
Q: What would your
answers be?
programming environment that allows pro-
grammers (and testers) to be productive
more effective and more valuable software Did you exhaustively test quickly.
tester. this? Are we doing an SVT
Here’s a broad introduction to the after our BVT? Does the More MS Stuff
Microsoft environment and some of its related performance testing pass? MSTEST / Integrated with Visual Studio
products. If you’re already .NET-savvy, feel What are your equivalence Professional, enables programmers to write
free to skip around. classes? Which heuristics low-level tests in their language of choice to
are you using? perform API testing. http://msdn.microsoft
Microsoft Tools and .NET Components .com/en-us/library /ms182489(VS.80).aspx
ADO.NET / A technology anyone can use to
connect programming code to a database.
A : ST&Pedia will help
you answer questions
WEBTEST / Software that records the
like these and earn the
respect you deserve. HTTP traffic that goes from the server to
ASP.NET / A framework that allows the Upcoming topics: the browser – it does not test the GUI.
developer to embed ‘snippets’ of code in Web http://msdn.microsoft.com/en-us/library
pages, for example, to populate a table from a October /ms364082 (VS.80).aspx
database. Visual Studio provides additional Security & Code Analysis
tools to view and edit the page without look- LOADTEST / Simulates simultaneous users
ing at code. November on a Web site using unit tests or existing
Testers Choice Awards
WebTest scripts. http://msdn.microsoft.com
C# (see-SHARP) / An object-oriented pro- December /en-us/ magazin /cc163592.aspx
gramming language based on C++ with influ- Test Automation
ences of Delphi and Java. Its code runs in a TEAM FOUNDATION BUILD / A contin-
January 2009
managed runtime environment. Application Life Cycle
uous integration feature of TFS. http://
Management msdn.microsoft.com/en-us/library/ms181710
EXPRESSION WEB / Microsoft’s profes- (VS.80).aspx
sional Web layout tool; formerly known as February
Microsoft FrontPage. Defect Tracking Free Stuff
NUNIT / Similar to MSTest, NUnit is a port
IIS / Internet Information Server. Micro- March of the JUnit framework for .NET languages;
Web Performance
soft’s Web server manages requests for Web Management open source. http://www.nunit.org/
content by executing code or ‘serving up’
data files. WATIR / Short for “Web Application Testing
In Ruby,” Watir is a set of Ruby libraries that
Matt Heusser and Chris McMahon
SILVERLIGHT / Microsoft’s competitor to are career software developers,
drive Internet Explorer and monitors tests as
Quick Time and Shockwave, Silverlight is a testers and bloggers. They’re col- they run. Open source. Other implementa-
Web browser plug-in that supports animation, leagues at Socialtext, where they tions include those for Firefox (FireWatir)
graphics, audio and video. perform testing and quality assur- and Safari (SafariWatir), .NET (WatiN) and
ance for the company’s Web- Java (WatiJ).
SQL SERVER / A database engine similar to based collaboration software.
WatiN - http://watin.sourceforge.net/ ý
Watir - http://wtr.rubyforge.org/
Access designed to scale to massive numbers

SEPTEMBER 2008 www.stpmag.com • 13


By Pete Jenney

typical Web application, regardless of development language,


A consumes hundreds of thousands lines of code from local and
remote systems, from the very lowest goal of hackers is generally to destabi-
transport protocols to rich browser UI lize applications, which may be done
components and data storage mecha- simply by attacking them via the
nisms. And, for the most part, we often resources they depend on.
don’t have a clue whether the code is any Application security depends a great
good. These quality issues are staggering deal on application stability. Stability
and should be keeping you up at night. depends a great deal on how applica-
But for applications running on tions manage the resources they depend
Windows, quality can reasonably be on, specifically how they handle excep-
assumed at several levels. For example, tions caused by missing resources or cor-
it’s pretty safe to assume that network rupted data delivered by resources.
drivers and other core operating system Consider the following code snippet:
services are stable and secure. To a cer-
tain extent the same assumptions can BOOL getPdata(char* buf, DWORD*
cnt)
be made about applications higher in {
the stack, but these assumptions have to m_hPipe = CreateFileA( szPipeName,
be tempered with a dose of reality.
GENERIC_ALL | SYNCHRONIZE,
Consider first the resources on which a
typical Windows application depends, FILE_SHARE_READ,
as illustrated in Figure 1.
Failure can start at any level, with the NULL,
ultimate result being failure of the appli- OPEN_EXISTING,
cation. In a compound/n-tier environ-
ment, failure of an application may repre- FILE_ATTRIBUTE_NORMAL,
sent the failure of a server, which, in turn,
NULL );
may result in failure of another applica-
tion, and so on down the line. In all cases, if( m_hPipe ==
failure will have some effect on systems INVALID_HANDLE_VALUE )
{
that are dependent on it, and therein lies
// TODO: Come up with a
the issue that we’re here to consider. good failure timeout in 2.0
Application stability depends on the }
availability and correctness of resources

Disciplines for Testing Apps


Running on the Stack That Is
Windows, .NET, Internet
Information Server and SQL Server
that are consumed. When either is com- ReadFile( m_hPipe, &Ack, sizeof(Ack),
promised, the resulting behavior is &dwBytesRead, NULL );
memcpy(buf,Ack,VdwBytesRead);
undefined—read “unstable.” In addi-
*cnt = dwBytesRead;
tion to making users unhappy, unstable return( TRUE );
applications are the fodder of attackers }
Photograph by Gabriel Moisa

as instability typically leads to Note that return values are not


exploitable vulnerabilities; hence, the checked at the time the pipe is created,
nor when it’s been read. Also note that
Pete Jenney is director of technology devel- the read data is never checked in any
opment at Security Innovation, an application
way, but immediately copied into the
security and risk assessment consultancy.
calling buffer and that the size of the
www.stpmag.com • 15
STACK ATTACK

FIG. 1: APP DEPENDENCIES when you crash an Techniques for testing compound
application in isola- applications vary, and the approach we
tion, it only takes will take here will be to simulate envi-
n
Application down the system it’s ronmental conditions that lead to appli-
running on. In a cation failure. Discovery and execution
compound applica- will leverage several off-the-shelf tools—
.NET Framework tion, it not only takes some freeware and some commercial—
itself, but potentially and target the platforms, including IIS,
many others too. .NET and SQL Server, with the goal of
OS/Services (Win 32) And, of course, each forcing flaws that propagate unstable
of those other behavior across the servers in a com-
Storage Memory Network Registry DLLs servers may be pound application.
depended on by
other compound Breaking Applications
calling buffer is unknown. Developers applications, etc. You get the picture. The most effective approach to breaking
and testers familiar with secure coding This article will highlight some spe- applications is to force them to respond
practices will find this rife with defects, cialized testing techniques and postu- to hostile conditions with appropriate
but the two critical ones are buffer over- late mechanisms for testing com- error/exception handling mechanisms.
flow and data corruption. pound applications running on the If no such mechanism exists, the appli-
Any developer writing code like this Microsoft stack. It will get you thinking cation will generally fail, or at least
should be taken out and shot at dawn, about what error handling means in become unstable and display unexpect-
naturally, but it is a good example and an interdependent runtime environ- ed behaviors. The attack vectors that will
it’s not made up. No kidding, this is ment, how forcing errors during run- provide the best results are typically
actual code. Any application calling this time is a critical activity in developing those that applications consume regu-
function will have to be prepared to secure and stable applications, and larly and that developers are least likely
handle all types of failures depending how you might apply these techniques to worry about when developing excep-
on what the caller needs to do with it. to your own environments. tion handlers. Specifically, these are:
Now consider this code snippet: • Registries
Testing on the Stack • File streams
try Compound applications are deployed • Network streams
{
char* buf = new char[MAX_PATH];
using stacks of other applications, with • Memory
int bytesRead, realLen; the Microsoft implementation being • Libraries (DLLs)
among the most popular. Its primary Attacks that focus on these items
BOOL pipeOpened = getPdata(buf, &bytesRead);
components are IIS for Web services, will yield some pretty spectacular
if(pipeOpened) .NET framework for application servic- results in many cases. In terms of the
{ es and SQL Server for data services compound application, simple appli-
if( (realLen = dataValid( buf )) != 0 ) // call our (see Figure 2). Each component in the cation failures could cause ripples
data cleanser
{
stack is, in itself, quite stable. However, throughout the entire system. Forcing
parseAndSend(buf, realLen); as we’ve seen, the applications that failures in each of these areas is two-
return( TRUE ); depend on them are the primary con- phased, requiring discovery and action
} cern, and forcing failures on one serv- using tools or done manually. In each
else
{ er will help to uncover dependency case, the activity is slightly different,
throw(“Malformed Data Error”); defects in others. and non-exhaustively described here.
}
}
} TABLE 1: PLAN OF ATTACK
catch(…)
{ Iteration Server Test Goal
logerror(_LINE_, “Pipe OpenFailure”);
} 1 Web Catastrophic Force other server failure

return( FALSE ); // Default, return failure 2 Database Catastrophic Force other server failure

3 Application 1 Catastrophic Force other server failure


This code is prepared for failure and
will do the right thing if the data is cor- 4 Application 2 Catastrophic Force other server failure
rupt or if anything messes around with
5 Web Memory Constraint Force I/O & processing slowdown
memory. Hence, it is hardened and will
stand up to fairly rigorous testing. Most 6 Application 1 Registry Key Force application failure
code however, will not. Corruption
Testing applications for fragility in
7 Application 2 Memory Constraint Force application failure
compound environments is similar to
testing those in an isolated environment. 8 Database Network I/O Force client/caller failure
The same exploratory and fault injection Corruption
techniques apply. The difference is that

16 • Software Test & Performance SEPTEMBER 2008


STACK ATTACK

Attacks Using the Registry the resul -data is fuzzed? There are sev- tem. Errors can be simple allocation fail-
Applications may rely heavily on the reg- eral methods to fuzz effectively, includ- ures, or they can be corrupted pointers
istry for runtime support. Interesting ing on-the-wire protocol fuzzing and or other local or heap manipulations. In
items such as configuration, file location network I/O virtualization. Each has any case, forcing memory allocation
and license information are good exam- its advantages and the result is gener- errors is great way to quickly force inter-
ples of things that applications regularly ally the same—sometimes spectacular esting failures in applications of all types.
store and consume from there.
Applications typically assume that they FIG. 2: DIVIDE AND CONQUER
have access to the registry and that the
data stored there is correct. Therefore,
the registry is a clear point of failure and Global Failure Conditions
a prime attack vector for attackers. • Server Unavailable
Successfully attacking applications is a • Server Unstable User Interface
matter of denying access to the registry • Server Data Corrupt
data, changing it or corrupting it some- • ...
how. Consider replacing a temp file path
Internet Explorer (IE)
with garbage like X:\\#$ERW—
&UD^\\@#!D.FOOF, and the application
trying to open or create it. Naturally, the
operating system would reject it as hav- Web Server
ing invalid characters, but what does the
application do with it? What happens if
the UI window width is set to 224 or some
Internet Information Server (IIS)
other ridiculously large number?

Attacks Using File Streams


Applications typically assume that the Application Server
files they create are perfect and will
sometimes consume anything as long as
the file extension is correct. Corrupting .NET Framework
files, also referred to as “Fuzzing,” is
becoming very popular in testing circles
and is an integral part of the Security Local Failure Conditions
Data Server
Development Lifecycle (“The Security • Memory Unavailable
Development Lifecycle,” Microsoft Press, • Registry Corrupt
2006). With its increasing popularity, it is SQL Server • File Stream Corrupt
also beginning to attract tool developers • Network Stream Corrupt
who see automating the process as an • Library Missing
opportunity. Fuzzing the file stream can • ...
lead to application failures of all sorts.
For example, if the pagination data in a
word processing document header is off and always interesting application fail- Attacks Using Library
by a million pages or the value is corrupt, ures that allow attackers to rip into the Dependencies
the application will likely die a horrible soft underbelly of poorly written appli- Failing to check the return value of
death. File stream fuzzing attacks quickly cations and pull out data. LoadLibrary() calls is another exam-
and simply, and hence is popular with ple of assumed ownership, and one
the hacking community. In real life, acci- Attacks Using Memory that makes it easy to quickly knock
dental file corruption can lead to appli- Dereferencing NULL pointers in C/C++ over applications and potentially pro-
cation stability issues. is a classic faux pas and has lead to thou- vide an obvious attack vector. Consider
sands of failures in software of all types. a difference between security and
Attacks Using Network Streams Those of you old enough may remember functional testing. In functional test-
Like file streams, applications tend to the awful feeling in your stomach as you ing, if you pull a DLL away and the
assume that the network I/O they per- watched your hard disk formatting after application crashes, that’s a bad thing.
form always yields perfect data in and a crash while developing C programs on In security testing, if you pull a DLL
perfect data out. Fuzzing the data DOS 3.x. Memory errors are not just lim- away and the application doesn’t
coming off the stream can certainly ited to C/C++ though. Canonically, all crash, that’s a bad thing. Why?
lead to application failures, both in languages have to call the operating sys- Because the application that loads it
general and in conjunction with spe- tem memory allocator at some point, doesn’t check to see if the call suc-
cific activities, such as SQL queries and they all have to do it through the ceeded. So, an attacker can just write a
and result-data processing. For exam- same interface(s). Hence, memory replacement DLL, replace the original
ple, what happens if a query is fuzzed errors can be forced regardless of the with it and own the application. The
and the result data is not checked, or platform by using an API intercept sys- unchecked load behavior will naturally

SEPTEMBER 2008 www.stpmag.com • 17


STACK ATTACK

FIG. 3: AN EYE ON EVENTS Getting Started


Understanding what’s going on behind
the scenes between the servers requires
logging and keen observation. Before
starting anything, make sure that all the
logging capabilities are started and in as
verbose a mode as possible to support
future correlation analysis. Also make
sure that all the servers are synced to
the same timeserver (e.g., time.win-
dows.com) and are current, again to aid
in future correlation analysis.
Our sample plan (see Table 1, page
16) will pass through several iterations,
with the first being dramatic and repre-
senting catastrophic failure of one serv-
lead to a crash as the application calls water for delivery over the Internet. The er at a time. It will then proceed to
any of the methods in the missing DLL other is a third-party application for more granular tests, with specific goals
and immediately fails over, which pro- doing left handed smoke shifting and in each.
vides another juicy attack vector to presents as a Web service.
exploit. Each sample test run will describe a Iterations 1 – 4
different fault or set of faults along with Force applications to manage a missing major
Breaking Compound Applications tooling and techniques for applying resource by taking it away unexpectedly.
The five attacks described above may be them. The goals of each are first to A missing server may cause several
applied in several ways on individual sys- understand the behavior of our applica- very real problems, and it’s the job of
tems, and in most cases have similar tion in relation to the others in the sys- the application that depends on it to
applicability in compound applications. tem, and then the reciprocal. manage loss of access and fail securely.
For example, a named pipe is still a The toughest tests target the appli- The process is straightforward: If the
named pipe whether it’s connecting two cation servers—we’re trying to cause servers all run on a single server, kill
local processes or two remote servers. them to fail based on one after the other with-
The bottom line is that interdependent input from the others— out allowing them to use
servers need to incorporate all the
error/exception handling mechanisms
for all services, not just those they own.
The tack we’ll take here is to attack the
and any direct or indirect
interactions between
the two. The tests will
simulate resource con-
• their shutdown handlers.
For servers running on
different machines, you
can just disconnect them
compound application components straints and data corrup- Collecting from the network or give
and destabilize them. tion from the database them the old “Full
Interactions between the servers dur- and Web servers, which is traffic and logs Nyweide” and kick their
ing testing may be subtle or dramatic, more typical of a real-life power cords out of the
and collecting runtime data from all of situation, and the results is a best practice wall. Again, don’t let the
the participants is key to success. To that are visible to the other systems execute any of
end, it makes sense to borrow several servers. for all tests of their normal shutdown
tools and techniques from the network Several tools from the code; it has to be abrupt
management world that are focused on network management this nature to make the AUT react
collecting runtime information from all realm may be useful in realistically.
the devices. Yet, instead of using them to this process, where man- and will show During the test, it is
locate the root cause of a problem, we’re aging multiple disparate useful to sniff and cap-
looking for how a root cause affects the devices is what they do. interesting ture the network traffic
systems around it. Key assets to collect Applying some of that between the applications
during each test run from every server
are those that capture time-stamped
tooling to the testing
process will greatly speed
connections. and the downed server to
understand which types
runtime information, for example: things up, especially of recovery activities are
• Event logs
• System/application logs
• API call logs
• First chance exception logs
things that do automatic
event correlation across
multiple servers. When
you start trying these
• attempted, if any. This
information may be cor-
related with that in the
system and event logs of
• Network traffic logs, etc. techniques, it’s usually a good idea the still standing servers. Collecting
Test planning is based on an imagi- to talk to your local network adminis- traffic and logs is a best practice for all
nary application that consists of an IIS trators and find out and borrow what tests of this nature and will show inter-
Web server, two simple .NET applica- they use to monitor and manage esting connections, e.g., how a memo-
tions and a SQL Server. One of the .NET things. This could save a ton of analy- ry allocation failure caused an applica-
applications is ours, which digitizes sis time. tion server to fall over.

18 • Software Test & Performance SEPTEMBER 2008


STACK ATTACK

Iteration 5 to be used a lot and jump over to it in sensitive data or affect the way that the
Force memory constraints on the Web server your favorite registry editor. Save the application communicates with other
with the goal of putting it into some form of entire section of the registry you’re servers and destabilize entire com-
failure state that will slow it down and do going to work on before actually pound applications.
odd things. touching it, and then try to change
The conditions we want to create the values of the interesting key(s). If Iteration 7
will force the Web server to hit the you can’t change the values, stop the Force a failure in an application by fuzzing
swapper and start to thrash. This may AUT, change things around and file streams it consumes and make it crash,
or may not cause failures in the con- restart, keeping an eye on the key to perform non-deterministically or forward cor-
suming application, but it will be a data see if the AUT alters it/them during rupted data.
point either way. startup or shutdown. File fuzzing is becoming popular
There are a couple of ways to create If the AUT does manipulate the key, among testers, and there are a lot of free-
memory constraints and failures. The and you still can’t edit it at run-time, try ware and several good commercial tools
first is to tear open the machine available that do it well. The trick
and start pulling chips out. The
second is to start a lot of applica-
tions that will compete for mem-
ory. But the easiest is to use a
• to success is to find all the files
that applications consume and
when they use them, and then
corrupt them in a meaningful
fault injection tool to set up a File fuzzing is becoming popular way that will cause failures.
very low value for the available Finding them is simple with
system memory or to set up spo- among testers, and there are a some commonly available tools;
radic allocation failures. A test- fuzzing them is best done by one
ing tool that virtualizes applica-
tions is a good choice here
lot of tools that do it well. of the commercial or free
fuzzing frameworks and/or
because it allows testers to products. For cases like the
manipulate their runtime envi-
ronment and allows you to
quickly manipulate the memory
available to just the application
• Microsoft SDL, where it’s a
requirement to open 100,000
corrupt files of the type the
application creates and reads,
under test (AUT), so memory con- a fault injection tool that virtualizes the consider a tool that virtualizes a single
straints won’t affect any other programs application and allows real-time manipu- file and re-corrupts it on every open.
running on the system. lation of the keys. Failing that, just delete Consider the following pseudo code
Using the tool to simulate network the darned things. If the application is snippets:
bandwidth limitations and random cor- fragile, missing keys will send it reeling.
ruptions in the network stream will also Try several avenues to cause failure // Open and use the virtual file 100000 times, if it
fails, bail out
cause the Web server to react in inter- when working the registry such as: For( I = 1 to 100,000 )
esting ways and, in turn, drive interest- Corrupting key values—if the appli- App.FileOpenUseAndClose(“myfile
ing behaviors in dependent systems. cation uses data to control execution .mine_I_own_it.you_cant_have_it”)
Next I
Again, as the application is virtualized flow or configuration, out of range or
the rest of the system is not exposed to corrupted values may destabilize things Return “All Good”
the faults the AUT sees. Forcing error return values—if
While the Web server is being beaten your tools allow registry call return val- :ErrorTrap
up, pay careful attention to the system ues to be overridden, try returning Return “Failed on “ + I
and event logs on all the systems in the REGISTRY_CORRUPT or ACCESS
test and the applications. After the test _DENIED //—————————————————————
run is complete, all of the logs should Changing paths—if the application
// Open and use 100000 different files, if it fails, bail
be saved for later reference, or, if some- uses keys to point to configuration or out
thing crashed, immediately reviewed for temp files, change them and try redi- Array String[100000]// 100000 files I hand built …
coincident events. recting data to non-standard places, took me forever
// I hate my job and my boss
pipes or shares
LoadNames(Array)
Iteration 6 Changing the key type—try chang-
Force a failure in an application by corrupt- ing the type of data the key stores, for For( I = 1 to 100,000)
ing registry keys it consumes and make it example, a string to binary or other App.FileOpenUseAndClose(Array[I])
Next I
crash or perform non-deterministically. type.
Finding the registry keys an appli- While you’re manipulating the reg- :ErrorTrap
cation uses is pretty easy using com- istry, pay attention to the system and Return “Failed on “ + I
monly available free and commercial event logs and watch for odd behavior Follow the same steps as in iteration
tools. Several run in parallel to appli- from the other servers. Failures in reg- six to set up the AUT and locate targets
cations and capture all of their reg- istry reading may be pretty dramatic in to manipulate. Files are slightly differ-
istry, allowing you to get a good feel some cases and subtle in others. Loss ent than registry values because a
for how it is used and what keys might or corruption of data may cause com- process may create a file at runtime,
be interesting. Select a key that seems plete failure or allow redirection of keep it open and locked, and destroy it

SEPTEMBER 2008 www.stpmag.com • 19


STACK ATTACK

A
at shutdown. So you’ll need to find files
that are available at runtime and that STACK OF TESTING TOOLS
the application really uses. Fuzzing
comes in two basic flavors: random and There are several tools both commercial and free that are great for implementing the test-
parametric. Random just corrupts bytes ing described in this article. Most have overlapping functionality, but in many cases the
standalone implementations are best for a specific task.
wherever; parametric allows specific
parts of files to be changed/corrupted RegMon for Windows v7.04 by Microsoft [SysInternals]
in specific ways. It’s best to experiment technet.microsoft.com/en-us/sysinternals/bb896652.aspx
with both. And while the tests are being RegMon is a free and very useful discovery tool that monitors all registry interaction from
executed, monitor all channels out of any and all running applications, and allows users to quickly jump to Regedt32 to manip-
the application for corrupted data too. ulate registry values.

FileMon for Windows v7.04 by Microsoft [SysInternals]


Iteration 8 technet.microsoft.com/en-us/sysinternals/bb896642.aspx
Force a failure in an application by fuzzing FileMon is a free and very useful discovery tool that monitors all file activity for any and all
the network streams it consumes and make it running applications, and allows users to quickly jump to files in Explorer for management.
crash, perform non-deterministically or for-
ward corrupted data. Peach Fuzzing Platform 2.0
Fuzzing network I/O is similar to peachfuzzer.com
Peach is a free and comprehensive fuzzing platform that allows on-the-wire fuzzing of net-
fuzzing files, and it’s more significant as
work I/O and files of almost any type.
the majority of data consumed by
today’s applications is network-based, Defensics 2.0 by Codenomicon
not file-based. Fuzzing channels can be www.codenomicon.com/defensics
done in two ways, by generating it on a Defensics is a powerful commercial fuzz testing platform for on the wire fuzzing of most
system and sending it to a target all protocols.
machine, or by virtualizing the network
Wireshark 1.0.0
I/O channels the application consumes
www.wireshark.org/about.html
and corrupting them on the fly. Both Wireshark, formally known as Ethereal, is a free and powerful tool for real-time monitor-
work well and should be used in con- ing and analysis of network traffic.
junction with a network sniffer to moni-
tor the response packets from other sys- WhatsUp Gold by Ipswitch
tems in the application. Try several dif- www.whatsupgold.com
WhatsUp Gold is an inexpensive professional-grade network discovery and management
ferent attacks on the stream like:
tool that provides real-time server and service monitoring.
• Randomly corrupt data from the
stream before it gets to the app Event Analyst
• Randomly corrupt data going to www.eventanalyst.com/index.htm
the stream Event Analyst is an inexpensive tool that allows the consolidation and correlation of serv-
• Insert long strings of AAAAs or er log files.
some other unexpected characters
Holodeck Enterprise Edition v2.8 by Security Innovation Inc.
As with file fuzzing, the results can be
www.securityinnovation.com/holodeck
dramatic and can easily destabilize the Holodeck is a professional-grade discovery and fault injection tool that virtualizes an
application under test. But unlike files, application’s runtime environment and allows testers to completely control its resources.
you can also target other machines for
abuse and send dependent machines
corrupted (or otherwise altered) data to registry I/O logs are useful in the and its loss might have broad impact on
test various different failure scenarios, process, as they may point to specific file systems outside the expected application
simulating various ways your AUT can offsets, call patterns and other interest- boundaries. Testing in a typical lab envi-
fall over and forcing responses. ing things that you might normally asso- ronment does not generally include the
ciate with normal server operation. depth needed to test all the needed con-
Simple Correlation Analysis Testing applications completely re- ditions, as it’s difficult to do, but using
For every system crash or instability, the quires that all the runtime conditions the techniques described here will help
rest of the components of the applica- in which they may fail are executed and get you moving in the right direction
tion need to be evaluated for events. tested. Understanding where applica- and quickly discover lurking problems.
The simplest method is a temporal tions are vulnerable or prone to insta- Testing on the Microsoft stack
search (see Figure 3, page 18), where bility is challenging, but using fault requires an additional layer of effort in
you take the timestamp of the crash injection and fuzzing techniques allows the quality process and carries a good
from the log and search for timestamps testers to force applications to exercise deal of manual labor to do properly.
in the same range in all the other log error handlers and quickly expose Much of the process can be accelerated
files. Network sniffer logs are a valuable problem areas. dramatically with the use of tools that
resource in the analysis and a weather In larger, compound applications, help with discovery and analysis [See
eye kept out for high traffic levels that this testing is more critical as the sidebar for suggestions], though there

setup and execution …yet. ý


might indicate recovery attempts or resources an application consumes or is no all-encompassing framework for
other situational activity. File, API and provides may be shared or dependent,

22 • Software Test & Performance SEPTEMBER 2008


> Gomez, Inc. 10 Maguire Road Lexington, Massachusetts 02420

JUST BECAUSE YOUR INFRASTRUCTURE


SURVIVED THE LOAD TEST DOESN’T MEAN
THE CUSTOMER EXPERIENCE DID TOO.
With Gomez Reality Load™ XF you can test from outside the With no software to buy or install, or advance reservations, you
data center — from machines in the real world — where the can start load testing fast.
unpredictability of network and user conditions can challenge And, you can easily combine load testing with our Active
today’s complex web applications. Network™ XF or Actual Experience™ XF products, for 24x7
Unlike competing offerings, Gomez Reality Load XF delivers a production monitoring.
global network of over 40,000 backbone and desktop testing For details in the United States call +1 877.372.6732, in
locations, more than 100 browser and operating system the United Kingdom +44 (0)1753 626 632, or in Germany
combinations, fast results and encyclopedic detail. +49 (0)40 53299 207. Or visit www.gomez.com.
So, even if your infrastructure survived a traditional load test,
with Gomez you’ll know if the customer experience did too. Gomez. Ensuring Quality Web ExperiencesSM.

Gomez® and Gomez.com® are registered service marks, and ExperienceFirstTM, Active NetworkTM XF and Active Last MileTM XF are service
marks of Gomez, Inc. All other trademarks and service marks are the property of their respective owners.
By Stephen Teilhet

he .NET Framework Class Library contains


T
public AppEvents(string logName, string source) :
this(logName, source, “.”) {}
many classes that allow testers to obtain diag-
public AppEvents(string logName, string source, string machineName)
nostic information about an application and the environment {
it is running in. This article will address specific solutions to this.logName = logName;
problems that both developers and QA personnel can use to this.source = source;
this.machineName = machineName;
make monitoring and debugging an application easier and
add to your arsenal of tools to make locating and fixing prob- if (!EventLog.SourceExists(source, machineName))
lems in your applications much quicker and easier. {
This code is written to run under C# 3.0 and the .NET EventSourceCreationData sourceData =
new EventSourceCreationData(source, logName);
Framework v3.5. However, nearly all of the code—except for sourceData.MachineName = machineName;
the code that uses LINQ (Language Integrated Query)—can
be compiled under C# 2.0 and the .NET Framework v2.0 and EventLog.CreateEventSource(sourceData);
}
v3.0. Also, some knowledge of LINQ is presumed.
log = new EventLog(logName, machineName, source);
Using Event Logs in Your Application log.EnableRaisingEvents = true;
Taking advantage of the built-in Microsoft Windows event log }
mechanism allows your application to easily log events that private EventLog log = null;
occur, such as startup, shutdown, critical errors and even secu- private string source = “”;
rity breaches. Along with reading and writing to a log, the private string logName = “”;
event log APIs provide the ability to create, clear, close and private string machineName = “.”;

remove events from the log. public string Name


You should use the event log mechanism to record specific {
events that occur infrequently. You should also try to minimize get{return (logName);}
}
the number of entries written to the event log, because writing
to the log causes a performance hit. Writing too much informa- public string SourceName
tion to the log can noticeably slow your application. Pick and {
choose the entries you write to the event log wisely. If you need get{return (source);}
}
to create a detailed log of all the events that occur in your appli-
cation, such as for debugging purposes, you should use the public string Machine
System.Diagnostics.Debug or System.Diagnostics.Trace classes. {
get{return (machineName);}
To easily add event logging to your application, simply add
}
the AppEvents class below, which contains all the methods
needed to create and use an event log in your application. public void WriteToLog(string message, EventLogEntryType type,
CategoryType category, EventIDType eventID)
LISTING 1 {
using System; if (log == null)
using System.Diagnostics; {
using System.Collections.Generic; throw (new ArgumentNullException(“log”,
“Open the event log before writing to it.”));
Photograph by Steve Dibblee

public class AppEvents }


{
public AppEvents(string logName) : log.WriteEntry(message, type, (int)eventID, (short)category);
this(logName, Process.GetCurrentProcess().ProcessName, “.”) {} }

A longtime .NET developer and author, Stephen Teilhet currently works public void WriteToLog(string message, EventLogEntryType type,
for security tool maker Ounce Labs. CategoryType category, EventIDType eventID, byte[] rawData)
{

24 • Software Test & Performance SEPTEMBER 2008


.NET TOOLBELT

if (log == null)
{ TABLE 1: THE APPEVENTS CLASS
throw (new ArgumentNullException(“log”,
“Open the event log before writing to Method Description
it.”));
} WriteToLog This method is overloaded to allow an entry to be written to
the event log with or without a byte array containing raw data.
log.WriteEntry(message, type, (int)eventID,
(short)category, rawData); GetEntries Returns all the event log entries for this event log in an
} EventLogEntryCollection object.

public EventLogEntryCollection GetEntries() ClearLog Removes all the event log entries from this event log.
{
if (log == null) DeleteLog Deletes this event log and the associated event log source.
{
throw (new ArgumentNullException(“log”, CloseLog Closes this event log, preventing further interaction with it.
“Open the event log before retrieving its
entries.”));
} NA = 0, will also help during a forensics investiga-
Read = 1, tion after a security breach occurs. The
return (log.Entries); Write = 2,
} ExceptionThrown = 3, logs can be compared to determine not
BufferOverflowCondition = 4, only if the attacker had access to modify
public void ClearLog() SecurityFailure = 5, the event log, but also which events were
{ SecurityPotentiallyCompromised = 6
if (log == null) modified. Unless the attacker had access
}
{ to the local and remote event logs, a
throw (new ArgumentNullException(“log”, public enum CategoryType : short forensics investigation can easily uncover
“Open the event log before clearing {
it.”));
the motives of the attacker and the extent
None = 0,
} WriteToDB = 1,
of the damage.
ReadFromDB = 2, Let’s dive into the specifics of the
log.Clear(); WriteToFile = 3, AppEvents class. The methods of the
} ReadFromFile = 4,
AppEvents class are described in Table 1:
AppStartUp = 5,
public void CloseLog() AppShutDown = 6, An AppEvents object can be added
{ UserInput =7 to an array or collection containing
if (log == null) } other AppEvents objects; each
{
throw (new ArgumentNullException(“log”, The AppEvents class provides applica- AppEvents object corresponds to a
“The event log was not opened.”)); tions with an easy-to-use interface for cre- particular event log. The following
} ating, using and deleting one or more code creates two AppEvents classes
log.Close();
log = null;
event logs in your application. Your appli- and adds them to a generic Dictionary
} cation might need to keep track of sever- collection:
public void DeleteLog() al logs at one time. For example, your
{ public void CreateMultipleLogs()
application might use a custom log to
if (EventLog.SourceExists(source, {
machineName)) track specific events, such as startup and AppEvents appEventLog = new
{ shutdown, as they occur in your applica- AppEvents(“AppLog”, “AppLocal”);
EventLog.DeleteEventSource(source, tion. To supplement the custom log, your AppEvents globalEventLog = new
machineName); AppEvents(“System”, “AppGlobal”);
}
application could make use of the securi-
ty log already built into the event log sys- Dictionary<string, AppEvents>
if (logName != “Application” && tem to read/write security events that logList = new Dictionary<string, AppEvents>();
logName != “Security” && occur in your application. logList.Add(appEventLog.Name,
logName != “System”) appEventLog);
{ Support for multiple logs also comes logList.Add(globalEventLog.Name,
if (EventLog.Exists(logName, in handy when one log needs to be cre- globalEventLog);
machineName)) ated and maintained on the local com- }
{
puter and another duplicate log is need-
EventLog.Delete(logName,
machineName); ed on a remote machine. This remote To write to either of these two logs,
} machine might contain logs of all run- obtain the AppEvents object by name
} ning instances of your application on from the Dictionary object and call its
if (log != null)
each user’s machine. An administrator WriteToLog method:
{ could use these logs to quickly discover
log.Close(); if any problems occur or if security has logList[appEventLog.Name].WriteToLog(“App
log = null; startup”,
been breached in your application. In EventLogEntryType.Information,
}
} fact, an application could be run in the CategoryType.AppStartUp,
} background on the remote administra- EventIDType.ExceptionThrown);
tive machine that watches for specific logList[globalEventLog.Name].WriteToLog(“App
The EventIDType and CategoryType enumerations
used in this class are defined as follows:
log entries to be written to this log from startup security check”,
any user’s machine. More about watch- EventLogEntryType.Information,
CategoryType.AppStartUp,
public enum EventIDType ing event logs for specific events later.
{ Keeping duplicate copies of event logs EventIDType.BufferOverflowCondition);

26 • Software Test & Performance SEPTEMBER 2008


.NET TOOLBELT

Storing all AppEvents objects in a ‘System.ArgumentException’ occurred in system.dll. Regardless of the state of the log vari-
Additional information: The source
Dictionary object allows you to easily ‘AppLocal’ is not registered in log ‘Application’.
able, the source and event log should
iterate over all the AppEvents objects (It is registered in log ‘AppLog’.) “. be deleted in this method.
that your application has created. Using The Source and Log properties must be matched, The DeleteLog method makes a crit-
or you may set Log to the empty
a foreach loop, you can write a single ical choice when determining whether
string, and it will automatically be matched to the
message to both a local and a remote Source property. to delete a log. The following code pre-
event log: vents the application, security and sys-
This exception occurs because the tem event logs from being deleted from
foreach (KeyValuePair<string, WriteToLog method internally calls the your system:
AppEvents> log in logList)
{
WriteEntry method of the EventLog
if (logName != “Application” &&
log.Value.WriteToLog(“App startup”, object. The WriteEntry method checks to logName != “Security” &&
EventLogEntryType.FailureAudit, see whether the specified source is regis- logName != “System”)
CategoryType.AppStartUp,
tered to the log you are attempting to {
EventIDType.SecurityFailure); if (EventLog.Exists(logName,
} write to. In this case, the AppLocal source
machineName))
was registered to the first log it was {
To delete each log in the logList Dictionary object, assigned to—the AppLog log. The sec- EventLog.Delete(logName,
you can use the following foreach loop: machineName);
ond attempt to register this same source
}
foreach (KeyValuePair<string, to another log, Application, failed silent- }
AppEvents> log in logList) ly. You don’t know that this attempt failed
{ until you try to use the WriteEntry If any of these logs are deleted, so
log.Value.DeleteLog();
} method of the EventLog object. are the sources registered with the par-
logList.Clear(); Another key point about the ticular log. Once the log is deleted, the
AppEvents class is the following code, deletion is permanent; and believe me,
placed at the beginning of each method it’s no fun trying to re-create a log and
You should be aware of several key (except for the DeleteLog method): its sources without a backup.
points. The first concerns a small prob- As a last note, the EventIDType and
if (log == null)
lem with constructing multiple {
CategoryType enumerations are
AppEvents classes. If you create two throw (new designed mainly to log security-type
AppEvents objects and pass in the same ArgumentNullException(“log”, breaches as well as potential attacks on
“Open the event log before writ-
source string to the AppEvents con- the security of your application. Using
ing to it.”));
structor, an exception will be thrown. } these event IDs and categories, the
Consider the following code, which administrator can more easily track
instantiates two AppEvents objects with This code checks to see whether the down potential security threats and do
the same source string: private member variable log is a null postmortem analysis after security is
reference. If so, an ArgumentException breached. These enumerations can eas-
AppEvents appEventLog = new
AppEvents(“AppLog”, “AppLocal”);
is thrown, informing the user of this ily be modified or replaced with your
AppEvents globalEventLog = new class that a problem occurred with the own to allow you to track different
AppEvents(“Application”, “AppLocal”); creation of the EventLog object. The events specific to your application.
The objects are instantiated without DeleteLog method does not check the
errors, but when the WriteToLog log variable for null, since it deletes the Searching Event Log Entries
method is called on the globalEventLog event log source and the event log itself. Now that your application supports writ-
object, the following exception is The EventLog object is not involved in ing events to the Event Log, it is possible
thrown: this process except at the end of this that the application might have added
method, where the log is closed and set quite a few entries to the log. To perform
An unhandled exception of type
to null, if it is not already null. an analysis of how the application oper-
ated, how many errors were encountered
TABLE 2: OTHER SEARCH METHODS and so on, you need to be able to per-
form a search through all of the entries
Searchmethodname Entry property searched
in an event log. You will eventually have
FindCategory (overloaded to accept a Category == categoryNameQuery to sift through all the entries your appli-
string type category name) cation writes to an event log to find the
entries that allow you to perhaps fix a bug
FindCategory (overloaded to accept a Category == categoryNameQuery
short type category or improve your application’s security sys-
tem. Unfortunately, there are no good
FindEntryType EntryType == entryTypeQuery search mechanisms for event logs.
InstanceID == instanceIDQuery
To fix this we have built the Event
FindInstanceID
LogSearch class, to which you’ll add stat-
FindMachineName MachineName == machineNameQuery ic methods, allowing you to search for
entries in an event log based on various
FindMessage Message == message.Query
criteria. In addition, this search mecha-
FindSource Source == sourceQuery nism allows complex searches involving
multiple criteria to be performed on an

SEPTEMBER 2008 www.stpmag.com • 27


.NET TOOLBELT

{
event log at one time. To illustrate how searching works,
var entries = from EventLogEntry
entry in logEntries let’s assume that you are using the
using System;
using System.Collections;
where FindInstanceID method to search on
entry.UserName == userNameQuery the InstanceID. Initially, you would call
using System.Diagnostics;
orderby
entry.TimeGenerated ascending
the FindInstanceID search method,
public sealed class EventLogSearch
select entry; passing in the EventLogEntryCollection
{
private EventLogSearch() {} // Prevent this class collection (which contains all entries in
return entries.ToArray(); that event log) or even an array of
from being instantiated.
}
EventLogEntry objects. A LINQ query is
public static EventLogEntry[] FindEntryType (
EventLogEntryCollection logEntries,
The methods shown in Table 2 (page used to search through the
EventLogEntryType entryTypeQuery) 27) list other search methods that could EventLogEntryCollection for specific
{ be included in this class and describe event log entry objects (EventLogEntry)
var entries = from EventLogEntry entry in which property of the event log entries that satisfy the where clause of the
logEntries
where entry.EntryType == they search on. LINQ query. The ToArray method is
entryTypeQuery The FindCategory method can be used to convert the resulting LINQ
orderby entry.TimeGenerated overloaded to search on the category query results into an array of
ascending
name, the category number or both. EventLogEntry object. The
select entry;
The following method makes use of FindInstanceID method will then
the EventLogSearch methods to find return an array of EventLogEntry
return entries.ToArray(); and display entries that are marked as objects that match the search criteria
}
Error log entries: (the value passed in to the second argu-
public static EventLogEntry[] ment of the FindInstanceID method).
public void FindAnEntryInEventLog(
FindTimeGeneratedAtOrAfter( LINQ is used in the event log
)
EventLogEntryCollection logEntries, DateTime
{ search because of its power and sim-
timeGeneratedQuery)
EventLog log = new plicity. Its declarative syntax is easier to
{
EventLog(“System”);
var entries = from EventLogEntry entry in read and understand, while at the
logEntries same time providing a wealth of oper-
EventLogEntry[] entries =
where entry.TimeGenerated >=
timeGeneratedQuery
EventLogSearch.FindEntryType(log.Entries, ations that can be performed on your
EventLogEntryType.Error); query. LINQ allows not only sorting,
orderby entry.TimeGenerated
ascending
// Print out the information
but also grouping, joins with other
select entry; data sets, and multiple search criteria
foreach (EventLogEntry entry in
return entries.ToArray();
entries) in the where clause. LINQ also allows
{ the use of set operations such as
}
Console.WriteLine(“Message:
} union, intersect, except and distinct,
“ + entry.Message);
What makes this class so flexible is Console.WriteLine(“InstanceId: on your data. There are aggregate
that new searchable criteria can be “ + entry.InstanceId); operators, such as Count and Sum, as
Console.WriteLine(“Category:
added to this class by following the same well as quantifier operations, such as
“ + entry.Category);
coding pattern for each search method. Console.WriteLine(“EntryType: Any, All and Contains. This is but a
For instance, the following example “ + entry.EntryType.ToString( )); sampling of the operations a LINQ
shows how to add a search method to Console.WriteLine(“Source: query can perform on your data. By
“ + entry.Source);
find all entries that contain a particular }
combining these operations, you can
username: } come up with your own custom search
queries for your event log entries.
public static EventLogEntry[]
FindUserName(EventLogEntryCollection logEntries,
Note that this search mechanism can The real power of this searching
string userNameQuery) search within only one event log at a time. method design is that the initial search
on the EventLogEntryCollection
FIG. 1: CUSTOM DEBUGGER DISPLAY returns an array of EventLogEntry
objects. This EventLogEntry array may
then be passed back into another
search method to be searched again,
effectively narrowing down the search
query.
For example, the EventLogEntry
array returned from the FindInstanceID
method may be passed into another
search method, such as the FindEntry
Type method, to narrow down the
search to all entries that are a specific
entry type (informational, error, etc.).
This can continue until the search has
been sufficiently narrowed down. The
following method finds and displays

28 • Software Test & Performance SEPTEMBER 2008


.NET TOOLBELT

entries generated at or after 5/3/2008, FIG. 2: DEBUGGER OPTIONS


marked as an error type entry, and con-
taining an event ID of 3221232483 by
simply passing in the results of one
query into another:

public void FindAnEntryInEventLog()


{
EventLog log = new
EventLog(“System”);

EventLogEntry[] entries =
EventLogSearch.FindTimeGeneratedAtOrAfter(log.E
ntries,
DateTime.Parse(“5/3/2008”));
entries =
EventLogSearch.FindEntryType(log.Entries,
EventLogEntryType.Error);
entries =
EventLogSearch.FindInstanceId(log.Entries,
3221232483);

// Print out the information


foreach (EventLogEntry entry in
entries) // Hook up the is passed as the WatchForAppEvent
{ System.Diagnostics.EntryWrittenEventHandler. method’s log parameter. This method
Console.WriteLine(“Message:
“ + entry.Message); log.EntryWritten += new
performs two actions. First, it sets log’s
Console.WriteLine(“InstanceId: EntryWrittenEventHandler(OnEntryWritten); EnableRaisingEvents property to true.
“ + entry.InstanceId); } If this property were set to false, no
Console.WriteLine(“Category:
“ + entry.Category);
• Create the event handler to exam- events would be raised for this event
Console.WriteLine(“EntryType: ine the log entries and determine log when an entry is written to it, effec-
“ + entry.EntryType.ToString()); whether further action is to be per- tively turning off the delegate. The sec-
Console.WriteLine(“Source: formed. For example: ond action this method performs is to
“ + entry.Source);
} add the OnEntryWritten callback
} public static void method to the list of event handlers for
OnEntryWritten(object source,
this event log.
Watching the Event Log for a EntryWrittenEventArgs entryArg) Note that the Entry object passed to
Specific Entry { the entryArg parameter of the OnEntry
Sometimes a way to search your event if (entryArg.Entry.EntryType ==
Written callback method is read-only, so
EventLogEntryType.Error)
log for specific events of interest is not { the entry cannot be modified before it
enough; you need a mechanism to is written to the event log.
alert you when highly important events Console.WriteLine(entryArg.Entry.Message);
occur, such as when an application ter- Console.WriteLine(entryArg.Entry.Category);
Creating Custom Debugging
minates unexpectedly or a critical secu- Displays for Your Classes
rity event is logged. What you need is a Console.WriteLine(entryArg.Entry.EntryType.ToStrin Moving on to something quite differ-
monitoring application to watch for g()); ent, here’s a useful debugging feature
specific log entries to be written to the // Do further actions here as that you can add to your classes. This
event log and then send an alert notifi- necessary... feature makes it a breeze to see at a
cation to the administrator. For exam- } glance in the debugger what particular
}
ple, you might want to watch for a log data is contained within each class
entry that indicates that an application This code revolves around the instance. Today, the default debugger
encountered an error from which it EntryWrittenEventHandler delegate, display doesn’t show any useful infor-
could not recover gracefully, or that a which calls back to a method whenever mation for your class. The onus is on
malicious user is trying to attack your any new entry is written to the event log. you to drill down into your class to
application by feeding it malformed The EntryWrittenEventHandler dele- find the data you are looking for.
data. These types of log entries need to gate accepts two arguments: a source of Wouldn’t it be much easier if the
be reported in real time to the appro- type object and an entryArg of type debugger just displayed this data up
priate person or persons. EntryWrittenEventArgs. The entryArg front?
Monitoring an event log for a specif- parameter is the more interesting of the The solution is to add a Debugger
ic entry requires the following steps: two. It contains a property called Entry DisplayAttribute to your class to make
• Create a method to set up the event that returns an EventLogEntry object. the debugger show you something you
handler to handle event log writes: This EventLogEntry object contains consider useful about your class. For
all the information you need concern- example, if you had a Citizen class that
public void ing the entry that was written to the held the honorific and name informa-
WatchForAppEvent(EventLog log)
{
event log. tion, you could add a Debugger
log.EnableRaisingEvents = true; The event log that you are watching DisplayAttribute:

SEPTEMBER 2008 www.stpmag.com • 29


.NET TOOLBELT

[DebuggerDisplay(“Citizen Full Name


debug them. But the more powerful You’ve also learned a mechanism
= {_honorific}{_first}{_middle}{_last}”)]
public class Citizen part of this feature is the ability for your that allows an administrator or other
{ team members to quickly understand person to be notified as highly critical
private string _honorific; what this class instance holds. This events are occurring in a system, such
private string _first;
private string _middle;
pointer is accessible from the as a network connection going down
private string _last; DebuggerDisplayAttribute declaration, or an attacker trying to break through
public Citizen(string honorific, but any properties accessed using the your application’s defensive perimeter.
string first, string middle, string last) this pointer will not evaluate the prop- And finally, you’ve seen a cool way to
{
_honorific = honorific; _ erty attributes before processing. make debugging much faster by taking
_first = first; Essentially, if you access a property advantage of custom debugging dis-
_middle = middle; on the current object instance as part of plays—introduced in the .NET Frame-
_last = last;
constructing the display string (assum- work v2.0—that you can use to auto-
}
} ing that property has attributes) it will matically display the relevant informa-
not be processed, and therefore you tion about your classes within the
Now, when instances of the Citizen may not get the value you thought you debugger window.
class are instantiated, the debugger will would. If you have custom ToString( ) So instead of spelunking through all
show the information the way the overrides in place already, the debugger the various items within your class,
DebuggerDisplayAttribute on the class will use these as the DebuggerDisplay searching for information while debug-
directs it to. To see this, instantiate two Attribute without your specifying it, pro- ging code, you can have the pertinent
Citizens, Mrs. Alice G. Jones and Mr. vided the correct option is enabled data contained within your object auto-
Robert Frederick Jones, like this: under Tools/Options/Debugging menu matically bubble up to the top level with-
item in Visual Studio 2008; see Figure 2 in the debugger window. You’re in good
Citizen mrsJones = new

.NET Framework for debugging. ý


Citizen(“Mrs.”,”Alice”,”G.”,”Jones”);
(page 29). shape to take better advantage of the
Citizen mrJones = new Citizen(“Mr.”, By using the event log mechanism
“Robert”, “Frederick”, “Jones”); built in to Windows, you can keep track
of issues that occur while your applica- REFERENCES
• This article and its code have been adapted from “C#
When this code is run under the tion is running in a production envi- 3.0 Cookbook,” Third Edition, written by Stephen
debugger, the custom display is used, as ronment. You now know how to create Teilhet and Jay Hilyard and published by O’Reilly
shown in Figure 1 (page 28). and use a class to manage event logs as (ISBN: 0-596-51610-X). Some of the code has been
modified slightly to fit the context of this article.
It is nice to be able to quickly see the well as to write data (events) to one or • Download the source code for Listing 1 at: stpmag
pertinent information for classes as you more event logs. .com/downloads/stp-0809_teilhet.zip

Without oversight, software projects can creep


out of control and cause teams to freak. But with
Software Planner, projects stay on course.
Track project plans, requirements, test cases,
and d efects via the web. Share documents, hold
discussions, and sync with MS Outlook®. Visit
SoftwarePlanner.com for a 2-week trial.

30 • Software Test & Performance SEPTEMBER 2008


Construct A Data
Framework For
Seamless Testing
Rules That Give Repetitive
Tests A Global Dimension

By Vladimir Belorusets

est automation architecture defines how to


T store, reference, group, share, and reuse test
scripts and test data. Script execution is frequently support-
ed by software, often called a test automation framework.
The framework is a common structure into which you plug
in scripts and data from independent test automation
tools. It is up to script developers to decide how to organ-
ize test data and how the scripts read them. Meanwhile, the
ease of test data manipulation and maintenance is one of
the key aspects of framework viability.
This article presents an approach to test data man-
agement derived from a small number of simple data
design rules. I have successfully implemented this archi-
tecture for test data management at Xerox and other
companies. Intuitive design and easy access to test data
for modification and maintenance allow significant
improvements to application test coverage.

Global and Local Test Data


Related test scripts are usually assembled into logical
groups, called test sets, to cover a specific functional area
in the application under test. A test set defines a list of
scripts that have to be executed by the test automation
framework in a particular order as a batch. Popular
examples of the test sets are the smoke test set and the
regression test set.
A script can belong to multiple test sets and run with
different instances of test data. The automation frame-
work extracts copies of the scripts (along with the asso-
ciated data files) from the script repository and runs
Vladimir Belorusets is SQA manager for DocuShare at Xerox.

www.stpmag.com • 31
DATA STRUCT

FIG. 1: TWO DIMENSIONS • How can we preserve the origi- reused, without changes, for testing
nal test data? a different functionality in a product
• Do we need to keep multiple just by modifying the test data.
instances of the data files for Separating the data from the scripts
each script? will also significantly reduce the
Successful adoption of a test total number of scripts that must be
automation framework depends on supported.
how effectively it supports the ease
of test data access and modification Rule 2: Test data should be presented in
and avoids conflicts of overwriting tables.
script data in the different test sets. Advantages. Presenting data in
tables facilitates design of data-driv-
Design Rules en tests. A data-driven test is a tech-
Based on industry practices, I have nique that allows one automation
developed a list of six general design script to implement many test cases
rules that have proven to be efficient by iteratively reading through a data
for organizing test data within the table one row at a time, using the
frameworks. These rules should be values in that row to drive the test.
considered as functional require-
ments when developing test automa- Rule 3: Data tables should be provided
tion frameworks in-house or when in external files and be easily available
evaluating commercial frameworks. for review and modification to the test
Here are the rules and the advan- case consumers.
tages that they bring to the test Advantages. I divide the users of
automation framework users: the scripts into two broad categories:
test automation engineers and sub-
Rule 1: Test data must be separated ject matter experts. Users belonging
from the test scripts. to the latter category usually do not
Advantages. This is the most fun- have programming skills, but they
damental principle in code design do have a deep understanding of the
applicable to any code including the business that an application under
test scripts. You will not believe how test automates. They know which
many times I have seen this rule data to apply to verify the subtleties
being violated. Because of that, the of the application’s functionality. If a
code had to be rewritten later with script is properly designed, the sub-
the missing deadlines. Once the pro- ject matter experts should be able to
gram is debugged and released you execute it easily without looking in
them on distributed hosts in a should avoid code change unless it’s the code. All they need to do is mod-
sequence defined by the test set. absolutely necessary. Any code mod- ify test data. If it takes considerable
Test data can be classified accord- ification is error-prone. effort to find the data file navigating
ing to scope. Global test set data are If the data are hard-coded, you through the tens of subdirectories,
shared and visible to all scripts within may change them in one place and then the test automation framework
a test set, and local data are visible forget to change them in the other is inefficient and unusable.
only within the originating script. places. Another reason is code inter-
Global test data usually represent the nationalization; all human-readable Rule 4: Global data common to all
configuration parameters, such as strings in the code should be repre- scripts in a test set must be separated
server name, starting Web page URL, sented by the vari-
and other items, which are common ables and stored FIG. 2: SCRIPT/DATA CATALOG
to all scripts. Figure 1 illustrates the in the separate
organization of the test sets. resource files. To
Every test automation framework change the locale,
architect should answer the follow- all you need to do
ing questions: is change the ref-
• How will we implement global erence to the new
data? locale directory,
• How will we change the script’s and no code edit-
local data? ing is required.
• Will the local data be overwrit- The main advan-
ten for every new test set? tage of this rule in
• If we want to rerun the script test automation is
later with data from a previous that the same
test set, do we need to reenter it? script can be
32 • Software Test & Performance SEPTEMBER 2008
DATA STRUCT

from the local script data. for test data organization FIG. 4: SUBSEQUENT SETS
Advantages. If script data files in a that abides by the presented
large test set contain both global design rules. The solution is
and local data, it takes more time to given for Windows, but the
modify the same data in all data same ideas can be applied to
files. This procedure is inefficient any platform, and the data
and error-prone. If we instead have a design rules are platform
central repository for global data, we independent.
need to do the modification only
once per test set and it will be imme- Data Organization
diately propagated to all the scripts. In this implementation, each script original local test data, you should
Everyone will be able to execute test is associated with only one data file. create a worksheet with the test set
sets in their environment just by It uses an Excel spreadsheet for pre- name and enter the new test data
modifying global settings and senting test data in the tables follow- there (Figure 4). This way, local data
reusing the original local data with- ing Rule 2. According to Rule 3, for different test sets are associated
out changes if they are still valid for these data files should be easily with the test set names (Rule 5) and
their tests. accessible by subject matter experts. can coexist in one data file (Rule 6).
This raises another funda- We use the following simple algo-
FIG. 3: FIRST TEST SET mental question on how to rithm for accessing local test data.
effectively group scripts Each script reads the associated data
and their data files for easy from the worksheet that has the test
location. set name the script belongs to. If
When an engineer begins there is no such worksheet, the data
a test automation project, the are automatically read from the
first task he is faced with is “Default” worksheet. If subject mat-
how to arrange scripts and ter experts want to modify the origi-
data. To conduct this task, I nal test data, all they need do is cre-
Rule 5: Local test data should be promote a practice of creating the ate a worksheet with the test set
uniquely associated with both the test application’s Functional Decomp- name in the data file.
script and the test set that contains the osition Model, where all of the appli-
script. cation’s functionality is decomposed Global Data Implementation
Advantages. An association with the into a hierarchy of functional areas Let’s look at a typical situation.
test set is necessary to run the same and subareas. This structure is then You’ve assembled a test set of 100
script in the multiple test sets but with mapped to a directory tree, which scripts developed by others. With the
different data. Note in Figure 1, I stores test cases and scripts under the scripts, you inherited their test data
assigned two dimensions to all local matching functional area directories. files. Every script in the test set uses
data: one index for the script, and the The subject matter experts do not Server_Name as an input parameter.
other one for the test set. need to review the individual scripts, You are comfortable with all test data
but they do need to know what the except that the server’s name in your
Rule 6: Local data for each test set script does and where its data are test environment differs from the
should be separated and coexist within located. one in the original data files. How
the same data file. Easy access to data files can be can you avoid the error-prone work
Advantages. To run the script, the provided by creating a script/data of editing all 100 data files to change
test automation framework extracts the catalog in MS Excel using its “Group the server’s name to the same value?
data file provided by the script devel- and Outline” feature (Figure 2). For The solution is global data for the test
oper from the script repository. To each script record, there is a link to set (Rule 4).
change data for the subsequent test set, the corresponding data file that you There are three options for where to
you need to overwrite that original can open, modify, and save directly store the global variables: Windows reg-
data file. This creates a data conflict. from the spreadsheet. istry, environment variables and files.
One possible solution is to have one Each data file has multiple work- One convenient way to implement
script and multiple data files corre- sheets with one mandatory work- global test data is through the environ-
sponding to every test set. Such an sheet, named “Default” (Figure 3). ment variables that one can easily view
approach creates overhead for data file That worksheet contains the
maintenance and for dynamically map- original test data provided FIG. 5: GLOBAL VALUES
ping the right data file to the script. If by the script developer.
we have only one data file with coexist- All worksheets have the
ing local data for every test set, it sim- same structure: the first row
plifies data inventory and search. Data contains headers (parameter
coexistence also protects against data names), and all other rows
conflicts and overwriting. contain test data values.
The following is an example of a Multiple rows indicate a data-
flexible and efficient architecture driven test. To modify the
SEPTEMBER 2008 www.stpmag.com • 33
DATA STRUCT

and edit with the test set executed


TABLE 1: UNIVERSAL SCRIPTS
System tool from the after Setup have
Windows Control Scripts Description access to global
Panel. Every test set Setup Sets global variables for the test sets data. Since the
starts with a Setup Test_Set variable is
Start Starts the application under test
script that creates defined, the indi-
the environment Automated test cases Scripts to exercise the functionality of the vidual scripts also
application
variables for all glob- know from which
al data within the Finish Closes the application worksheet to read
test set. Global vari- Reset Deletes global variables their local data.
able values are Close Tool Releases the automation tool license once all test We end every test
defined in the Setup sets are completed (included in the last test set) set with a Reset
Excel data file. script that deletes all
Test set name is environment vari-
one of the global variables whose column describes the sequence in ables for the current test set and incre-
value is used by every script to deter- which the test sets are assembled to be ments TS_CURRENT for the next test
mine which worksheet contains the executed by the test automation frame- set. When the Regression test set starts,
script’s local data (see an example in work. The “Test_Set” column contains the value for TS_CURRENT will be 2.
Figure 4). In some test automation the names of the test sets. Each row in Thus, in our implementation, every
frameworks, such as HP Quality the worksheet presents the values of test set contains the scripts presented
Center, the script can use the frame- the global variables for one test set in Table 1.
work API to get the test set name it (Figure 5). By using this test data architecture
belongs to. Here is a simple solution To run a sequence of test sets, we and modifying it for your environ-
that is applicable to any framework. need to define one more environment ment, you will be able to better and
This algorithm can be easily extended variable, TS_CURRENT, and manually more efficiently manage your test data
for more complex cases. assign it initial value 1. The Setup script in a way that lends itself to standardi-
Unlike other script data, the Setup in the test set Smoke from Figure 5 zation and reuse. In my experience,
data file has only one worksheet, with reads TS_CURRENT and creates envi- managing data in this way—using a
columns named after the global vari- ronment variables with values from the test automation framework—makes
ables. Two columns, “Order” and row whose Order number equates to my life as a tester much easier and far
“Test_Set,” are mandatory. The “Order” TS_CURRENT. Now, all scripts in the more enjoyable. ý

34 • Software Test & Performance SEPTEMBER 2008


A BZ Media Event

OCTOBER 28–30, 2008 • HYATT REGENCY RESTON • RESTON, VA

REGISTRATION NOW OPEN!


Sign Up Online To Receive the Latest Updates!
EclipseWorld: the first and only technology conference
dedicated 100% to Java development using Eclipse.
• Become a better Java • Explore the most popular
developer—today! free and commercial
Eclipse-based tools
• Stay on top of the newest
trends and developments in • Gain knowledge that you can
the Eclipse ecosystem bring back to your department
and team
• Learn how to use Eclipse
to build desktop, server
and Web Java applications REGISTER
BY SEPT. 26 FOR
• Understand how to extend Early-Bird
and customize Eclipse Savings!
for your organization SAVE $200!

www.eclipseworld.net
PLATINUM SPONSORS GOLD SPONSORS SILVER SPONSOR MEDIA SPONSORS PRODUCED BY

www.code-magazine.com
By Venkat Moncompu and
Sreeram N. Gopalakrishnan

apid prototyping and de-


R velopment techniques com-
bined with agile development
niques to meet the changing or evolving
user requirements and needs. Software
development is not a defined process, at
the very least because the main inputs
methodologies are pushing the to the process activities are people.
envelope on the best practice of testing Agile methods are people-oriented
early and testing often. Keeping pace rather than process-oriented. Agile meth-
with the quick development turn- ods are iterative. Iterative development
around and shorter time to market, and techniques adapt to changing require-
being adaptive to late changes in ments by focusing on the product devel-
requirements itself, requires effective
management of quality process.
Uncover Buried opment with “good enough” require-
ments. However, there’s still an element
The use of traceability of test arti- of planning involved per iteration where
facts—test cases, test defects, test fix- a subset of the required features are bro-
tures—mapped to the requirements—
needs, features, use cases, supplemen-
Quality By ken down into tasks, estimated in detail
and allocated to programmers.
tary requirements—as a QA scheduling Use case modeling is a popular and
and planning tool, though mentioned effective requirements management
in passing and claimed to have been
practiced, has been largely overlooked
Digging Up technique. Use cases capture most of the
functional requirements of a software
by the industry. This article explores a system. They describe the user goals and
study of software that involves iterative the sequence of interactive steps to
application development practices,
bringing traceability as a QA manage-
The Hidden achieve the goal. Use cases are widely
adopted in iterative software develop-
ment tool into focus. ment methodology, such as the unified
Many software methodologies have process and other agile techniques
come to be classified under the hood of
“Agile Methodology.” These methods
Traceability Of which are iterative or evolving in nature.
Verification techniques to derive test
came about in response to the need for cases from use cases are well established.
Photograph by Keith Binns

adaptive design and development tech- So planning testing cycles entails effective
niques as opposed to predictive tech- Your Artifacts traceability of test artifacts to require-
ments planned for the iteration. Though
The authors are project managers at Intellisys the emphasis in agile development is on
Technology, an IT services company based in
people rather than on process, on work-
Oak Brook, Ill.
ing software over comprehensive docu-

SEPTEMBER 2008 www.stpmag.com • 37


TRACEABILITY DIG

mentation, and responding to change and/or features (remember “just enough features are tested and verified. This
rather than following a plan, a QA man- documentation to develop software”). In further provides valuable feedback to
agement process needs to remain nimble agile methodology, the emphasis is on the project team (including the end-
to the changing and evolving needs and software construction rather than docu- user stakeholder) about the software
requirements. This is precisely where the mentation, unlike the traditional water- construction progress. To be effective,
traceability matrix can be leveraged to fall model of software development. The therefore, it is important that the
perform optimal QA activities that give two main premises of being agile are: traceability is mapped thoroughly
the most value. • The ability to welcome and adapt making the features provided trans-
to requirement changes later in parent to all stakeholders. And for the
Agile Testing the development life cycle. QA manager, it provides a good substi-
Agile QA testing involves closer and • Testing often and testing early (in tute from “traditional” selection crite-
tighter feedback within each cycle of iterative cycles). ria for regression and acceptance tests.
iteration, defining levels and types of Apart from these two basic tenets, It plays an important role in providing
testing in each cycle of iteration. How the other difference from a waterfall a basis for statistical information such
can planning of requirements testing model is that the requirements are as burn rates and velocity for the team
work with iterations? User needs in an never really “frozen” in development management.
agile process are defined by a story such that it becomes an entry criterion
(sometimes captured as use-cases and for the software construction phase. Multi-Dimensionality of Traceability
features) planned to be implemented Prototyping is the key aspect of agile For the sake of clarity, a case study show-
iteratively. Work breakdown for devel- development techniques that help in ing traceability to map test cases relating
opment (in iterations) of these use- getting user feedback early and contin- to use cases and features of a student reg-
cases and features is defined in terms of uously in the development life cycle. istration system is discussed here.
tasks. As a logical extension, the QA This reduces the “dreaded integration Consider a student-course registration sys-
effort can also be tasked for planning phase” late in the software development tem. It should have the following features:
and scheduling purposes. phase, minimizing the risk of falling • Users (Students, Registrars and
The scope of testing in iteration is short of user needs or ending up with Professors) should be able to regis-
usually a set of unit and (build) accept- unfulfilled requirements. ter with the system.
ance tests to verify the requirements User acceptance tests serve as exit • Users should be able to create,
and features planned for the iteration. (or acceptance of the build) iteration update or delete their profiles and
The need for constant and continuous criteria and to measure progress (or preferences.
regression testing is warranted as the burn rate) of the project. So, in tech- • Users (Students) should be able to
software construction evolves and bugs niques such as feature-driven develop- register for classes and securely pay
get fixed, just as it scopes the features ment and test-driven development, the for courses.
and use cases that go into the current mapping of the features and use cases • Users (Students, Registrars and
iteration or development cycle. Itera- to test cases—traceability—serves as a Professors) should be able to view
tions, being time-boxed, do not wait for valuable tool to effectively plan and the student transcripts based on
the exit or entry criteria to be met nor schedule testing just as features and access restrictions.
are they predefined. cards are used to plan development in • Users (Registrars and Professors)
Agile testing leaves a lot of room for iterative cycles. should be able to create course
exploratory and ad hoc testing that isn’t And just as use cases provide a user offerings and the system should
necessarily captured in the use cases perspective for developers and design- provide a catalog of courses.
ers; testers have the onus of ensuring As with any system of moderate com-
the software meets the user require- plexity, the set of requirements can
ments adequately. This can be effectively never be really termed “complete.”
achieved by mapping test artifacts to Therefore the process should be adap-
requirements that are modeled as use tive to changing user needs. But for the
cases and testing the intended function- sake of this example, these require-
ality independently. ments will suffice. A set of possible use
cases identified for the system are:
Scheduling and Iteration Planning The use case descriptions in Table 1
The agile techniques for software devel- (see References) define the main suc-
opment uses tasks in place of work cess scenarios of the system. However,
breakdown structures referred in tradi- not every use-case scenario ends in suc-
tional project planning tools. To effec- cess for the user. While elaborating the
tively understand the use of tasks and use cases using the descriptive text to
planning of effort from a QA perspec- capture these alternate paths, new
tive, it is useful to breakdown the QA aspects of the systems come to light
work product into iterations based on when exceptions are encountered (non-
the features and functional specifica- happy path behavior of the system is
tions that are planned for the iteration. being captured).
Traceability matrices provide a con- Spence and Probasco refer to them
venient way of ensuring the intended as overloading the term requirements, a

38 • Software Test & Performance SEPTEMBER 2008


TRACEABILITY DIG

FIG. 1: ARTIFACT EXCAVATIONS becomes effortless and convenient.


By establishing effective traceability
matrices, the tool helps to answer some of
Establish Identify Map SR Identify & Update the following questions apart from achiev-
Traceability Usability and execute Traceability
with UCs flows Rules test cases ing the traceability of requirements to
design and construction of the software:
Apart from the base code smoke and
build-acceptance tests, which test cases
Inception Elaboration Construction Transition Inception Elaboration should be selected to run for the cur-
rent build: Verify fixed defects or
regression suite for the current fixes?
common point of confusion with not exceed two courses outside the What impact does change in a spe-
Requirements Management. These may Major program of study. cific set of non-functional and function-
not be clear from the user needs and In the above case, when the map- al requirements have on the QA testing
system features captured, but they are a ping of the test case flows across func- process in arriving at test estimates?
vital and essential aspect of the system tionality is carried, it becomes evident How can defects identified be
behavior. To ensure that the system that the granularity of detail falls short mapped to the requirements that the
meets these requirements and for cov- when mapping the coverage of the test iteration was scoped to achieve?
erage to be effective, these have to be flows against the business rules as can What surround testing and re-testing
elicited clearly and traced completely. be seen in Table 4 (see References). have to be carried out for validation
Alternate paths may also be captured Based on the feature set as set out, before the defects can be closed out or
using a usability (scenario) matrix as it’s possible that any one of the flows new but related ones identified?
seen in Table 2 (see References). While used to ensure coverage of business What change requests were brought
the use cases are mapped against fea- requirement 1 could as well serve for about by the most recent build or itera-
tures (or cards) that are planned for the business requirement 2. However, on tion, and what impact on quality does
iteration, so can the use cases, the use- closer scrutiny, the test-case flow that this new change entail?
case scenarios that stem from these and tests the unhappy path scenario of busi- Establishing and maintaining trace-
so on, cascading to the test cases (and ness requirement 2 requires a further ability provides a hidden but valuable
test artifacts). elaboration of the test flows against fea- benefit—one of serving as a tool for
Note that the usage of the applica- ture set. Such gaps and inadequacies planning the testing tasks in the itera-
tion flow, even though captured, could will come to light in a traceability tion during iterative development.
end up varying the application flow matrix that is not granular and, conse- Traceability also establishes tracking
based on the data. For example, a stu- quently, the test coverage falls short. back to the exact requirements being
dent logging into the system would be Tracing every business, non-busi- implemented in the iteration improving
provided with a different set of features ness and non-functional requirement coverage and confidence in the quality
and screen flows compared to a profes- to test cases and scenarios should process. This is of greater significance in
sor or a registrar who uses the system. increase the confidence and coverage agile projects where requirements docu-
Supplementary requirements corre- of testing and QA activities that can be mentation isn’t complete as require-
sponding to the architectural require- performed. The usability flows and ments continue to evolve with each
ments for the system cannot be mapped concrete test cases that cover the build or iteration. Agility ensures the
unless captured separately. These requirements and needs can be formu- process (and the product) is adaptive to
remain outside the functional require- lated, and with each iteration, targeted changing requirements and using trace-

ification keeps up with these changes. ý


ments modeled by the use cases as seen test cases could be identified to be run ability for QA activities ensures that ver-
in the Table 3 (see References). or executed to address within the spe-
A sample list of business require- cific build. Traceability is really multi- REFERENCES
ments that have to be followed could dimensional, and to be effective QA • Tables 1 to 4 can be found at www.stpmag.com
be summarized as: artifacts, they have to transcend the /downloads/stp-0809 _moncompu.pdf
• Kurt Bittner, Ian Spence, Use Case Modeling,
• BR1: Students without pre-requi- various phases of the development Addison-Wesley, 2003.
sites defined for the course they process—initiation, elaboration, con- • Alistair Cockburn, Writing Effective Use Cases,
Addison-Wesley, 2006.
seek to enroll in should be pre- struction and transition (see Figure 1). • Dean Leffingwell, Applying Use Case-Driven Testing
vented from trying to register, i.e. Further, it has to be a “living” artifact, in Agile Development, StarEast 2005.
• Dean Leffingwell, Don Widrig, Managing Software
check out the course. one that is updated with each iteration. Requirements – A Use Case Approach, Addison-
• BR2: Students checking out cours- Within iterations, a set of acceptance Wesley, 2003.
es have to register within two work- and regression tests have to be sched- • Jim Heumann, Generating Test Cases From Use
Cases, The Rational Edge, E-zine for the rational
ing days from the time of initiation uled and performed to meet the exit community, www.ibm.com/developerworks/rational
checkout, otherwise the seats shall criteria. Features and stories (in the /library/content/RationalEdge/jun01/GeneratingTest
CasesFromUseCasesJune01.pdf, June 2001.
not be guaranteed and released to form of cards) are planned in iterations • Peter Zielczynski, Traceability From Use Cases to
the general pool. in an agile methodology. With traceabil- Test Cases, http://www.ibm.com/developerworks
/rational/library/04/r-3217/, 10 Feb 2006.
• BR3: If the courses are outside of ity matrix and mapping of the test cases • Bret Pettichord, Agile Testing What is it? Can it
the student’s planned Major depart- to features, use cases and defects, opti- work?, www.pettichord.com, 2002.
• Ian Spence and Leslee Probasco, Traceability Strat-
ment, then such courses should mum test planning assuring the soft- egies for Managing Requirements with Use Cases,
require an advisor override and can- ware quality within each build/release Rational Software Corp. white paper, 1998.

SEPTEMBER 2008 www.stpmag.com • 39


Best Practices

The .NET Result Of


Post-Deployment Testing
Like other companies in the more often than insuffi- “Successful predeployment testing of
midst of developing a new cient bandwidth or other individual processes and components
application, Emergisoft, an hardware-related causes, may not reveal deficiencies in the hand-
Arlington, Texas, developer Huizinga says. off from server to network, network to
of hospital emergency room But even if SQL queries user interface, or something else.”
patient management soft- are optimized, the very The wrong approach, says Rich
ware, did its homework. data being extracted can Yannetti, longtime test manager and
With a team of 10 in- lead to cumulative per- director of delivery at Technisource, is
house developers building a formance degradation. blindly adding hardware. “Hardware is
new generation of its Web- At one of Wall St.’s best- relatively cheap and it’s not that hard to
based, EmergisoftED hospi- known brokerage firms, a address performance issues by buying
Joel Shore
tal emergency department new customer service appli- bigger, faster servers with more memo-
management application, transaction cation started out well but gradually ry,” he says. “But if they already have 20
response times and other key perform- bogged down with each subsequent severs and don’t realize that one is han-
ance requirements had been defined in query, leading to screen refresh times dling half the traffic, the analysis needs
the SLA, says Godson Menezes, the com- exceeding two minutes. With predeploy- to be based on watching where packets
pany’s director of architecture and prod- ment testing uncovering no apparent go and doing load balancing.” Only
uct engineering. A test plan had been performance problems and plenty of rarely are performance problems relat-
developed, and a test environment that bandwidth available, profiling tools ed to insufficient bandwidth, he says.
“closely simulated an actual production zeroed in on data handling following In a post-deployment troubleshoot-
environment” was called upon to make queries and the efficiency of the user ing scenario, most application test
sure all aspects of the system performed interface as the key suspect areas, says experts recommend assembling a triage
properly,” Menezes says. Walt Sully, a senior manager and expert team of experts who can examine dif-
Yet when it was put into full produc- on software development methodology at ferent aspects of the overall system.
tion, performance of the system, built technology solutions provider Axispoint. Network troubleshooting includes an
on a foundation of Microsoft .NET, C#, “The pages were designed to pre-load analysis of bandwidth, congestion and
ASP.NET, COM+, IIS 6, Windows Server with drill-down detail that could be latency. An internal application that
2003 and Oracle, slid well below the revealed by clicking on a tree-view con- performs well at headquarters but
threshold of acceptability, a serious trol in the user interface,” he says. The degrades in branch offices needs to fol-
problem when people’s lives literally problem was that as the database grew, low packets as they are assembled and
hang in the balance. so too did query process time and the traverse the network in either direction
It’s a common problem. Looking time needed to assemble the extracted through switching components and
good on paper and performing well, information, resulting in large streams communications links. Likewise, a serv-
even in the most rigorous of test environ- for each screen preload. er analysis will determine if perform-
ments, are no guarantee that post-roll-out The brokerage scenario highlights ance is CPU-, memory-, or disk-bound,
performance will meet SLA targets. the inability of even severe predeploy- although, most experts agree, the prob-
“Look at how data is being accessed ment testing to perfectly emulate the lems most often lie elsewhere.
and stored,” says Dorota Huizinga, for- demands of production. “The transac- Examining application perform-
mer associate dean of the College of tion levels that an online retailer sees in ance with tools that track the con-
Engineering and Computer Science at the Christmas season may exceed what stituent components of a complete
California State University, Fullerton. was predicted, and the resulting systems transaction is crucial, says Eshelby. “It’s
“Reorganize the database, then exam- design may be deficient,” says Mark essential to see how each SQL state-
ine what is being cached and what can Eshelby, product management director
be cached. Even performing I/O from a at Compuware. He recommends a Joel Shore is a 20-year industry veteran and
designated part of a disk with the fastest triage approach that looks not just at has authored numerous books on personal
computing. He owns and operates Research
access can make a difference.” the behavior of individual system
Guide, a technical product reviewing and docu-
Inefficient data I/O and malformed components–-both hardware and soft- mentation consultancy in Southboro, Mass.
database queries are the culprit far ware–but also at their interaction.

40 • Software Test & Performance SEPTEMBER 2008


Best
Practices

ment or HTTP request performs.” structuring of queries or adding addi- tions were made that resolved all per-
DBAs trained in the optimization of tional networking resources in strategic formance issues, says Menezes.
SQL calls, whether to an Oracle, geographical locations. Though Emergisoft’s performance
Microsoft, My SQL or other database are After troubleshooting the Emergi– woes were found relatively quickly, that
almost always part of any large IT opera- softED application with the aid of a is not always the case, leading to politi-
tion. Specialists in HTTP opti- cal stress on the IT organization


mization are a newer breed, but and a potential loss of business.
are equally valuable. Even with “The entire development team
highly efficient database has to understand that they are
queries, determining which data all in this together, regardless
to return first and whether the Get the team together quickly and of where the actual problem is,”
entire screen or just a portion of says Technisource’s Yannetti.
it is refreshed can make a signif- keep management informed. “Post-deployment problem solv-
icant difference. ing is an area where the test
According to research firm manager needs to step up and
Gartner, the simple act of
opening a file can generate up
to 100 message exchanges.
Place the server and customer
• take the lead.”
Even with functional specifica-
tions that quantify the bounds of
acceptable performance and with
thousands of miles apart, and a 50-mil- thread analysis and application analytics a test environment that reproduces the
lisecond network latency for each of tool, performance degradation was production environment in terms of
those exchanges adds up to five sec- traced ultimately to a trio of factors: transaction load and simultaneous user
onds,before any transactions take place. SQL tuning and out-of-date or missing headcount, a post-deployment meltdown
Add hundreds or thousands of simulta- indexes. Once the offending SQL had can still occur. Get the team together

and keep management informed. ý


neous users, and the result can be unac- been captured and escalated to quickly, make sure assignments are clear,
ceptable performance that may require Emergisoft’s production DBA, correc-

Index to Advertisers

Advertiser URL Page

Automated QA www.testcomplete.com/stp 10

Eclipse World www.eclipseworld.net 36

Empirix www.empirix.com/freedom 6

Gomez www.gomez.com 23

Hewlett-Packard hp.com/go/quality 44

IBM www.ibm.com/takebackcontrol/secure 20, 21

iTKO www.itko.com 43

McCabe www.mccabe.com/stp 35

Qualitest www.QualiTest-int.com 3

Ranorex www.ranorex.com/stp 34

Reflective Solutions www.stresstester.net/stp 8

Seapine www.seapine.com/optiframe 4

Software Planner www.softwareplanner.com 30

Software Test & Performance www.stpmag.com 41

Software Test & Performance www.stpcon.com 2


Conference

SEPTEMBER 2008 www.stpmag.com • 41


Future
Future Test
Test

Break the Black


any testing approach primarily depends
on the tester’s professional skills, experi-
ence and in-depth knowledge of the sys-
tem. But testing complex software
should not only validate software from

Box Barrier! an end-user perspective, but must also


include more systematic in-depth analy-
sis approaches. This means that testers
must embrace new challenges and adapt
In the future, the value of improve the trustworthi- to the ever-changing demands of this
testing is not going to be ness of their solutions. highly dynamic industry in order to
measured using simplistic Behavioral testing is an remain competitive in their careers.
and meaningless measures important testing approach Testing complex software and critical
such as time spent testing for the ultimate success of systems requires testers with a broader
an area or raw bug count. In any software solution. Be- set of technical skills and knowledge
the future, the value of an havioral testing is extremely who can look beyond the user interface
internal testing organiza- valuable in exposing usabili- and perform a more in-depth investiga-
tion will be determined by ty issues, some types of user tion and systematic analysis of the system
its intellectual contribu- interface anomalies, obvious earlier in the product cycle. The testers
tions. Those include the defects and occasionally of tomorrow must be able to engage
Bj Rollison
ability to design effective more serious problems. But, much sooner in the product life cycle,
tests that accurately evaluate business-crit- as Boris Beizer noted, “Testing only to participate throughout the product life
ical product attributes and capabilities, its end-user perceived requirements is like cycle and expand their roles beyond glo-
capacity to work across disciplines, part- inspecting a building based on the work rified bug finders.
ner with developers and program man- done by the interior decorator, at the The role of the tester is shifting away
agers to prevent defects, and drive quali- expense of the foundations, girders and from that being an adversarial opponent
ty upstream, and its ability to identify and plumbing.” and maturing into a partner in the devel-
thoroughly analyze potential risks and We know that behavioral testing miss- opment life cycle. Testers will not only val-
provide important, timely, context-sensi- es critical issues and other functional idate design models earlier, but some
tive information that is relevant, and problems that sometimes require expen- testers will also work more closely with
enables the decision makers to make sive hot-fixes and service pack releases to developers and use their testing knowl-
informed business decisions. maintain the software over a prolonged edge to help write more comprehensive
All software companies face the period of time. The research firm IDC unit tests and participate in code inspec-
mounting challenges of long-term main- reported, “The increased complexity of tions and peer reviews. Testers develop
tenance costs, governmental regulation software development environments and test automation scripts to reduce long-
and compliance rules, ever growing secu- the cost of fixing defects in the field term maintenance costs, and some teams
rity risks, increasing complexity, the need (rather than early in the software cycle) will “ship” their automation to help inde-
for greater reliability and of course combine in exorbitant ways to drain pendent developers verify aspects of their
demands from the customer that the soft- income and to hamstring businesses as a implementation. And testers are engaged
ware just work intuitively! result of critical software downtime.” in root cause analysis efforts to identify
For the past several years, common We also know that fixing functional patterns of defects, building tools and
testing approaches for commercial soft- problems exposed by behavioral tests that refining processes for defect prevention,
ware relied primarily on business domain could have been detected or remedied and to help drive quality upstream. And
experts and other knowledgeable users to sooner in the development life cycle is yes, testers and others around the com-
“shake the bugs out” after the developers costly. Research by Victor Basili and Barry pany will still dog-food the products
have a working application. This was Boehm proved that defects detected in a under development to get a feel for
done by manually testing the usability testing phase after the implementation is behavioral usage in completing daily
and the functionality of the software complete can be more than seven times tasks to help with behavioral testing cov-
through the user interface and employ- as expensive compared to finding and fix- erage. Future testing professionals need

beyond the black box barrier! ý


ing simple record and playback tools to ing that problem earlier. And, a study by to shift the testing paradigm and break
“automate” simulated user actions. the National Defense Industrial Asso-
An intensively manual, end-user cen- ciation (NDIA) recently concluded that
tric approach to software testing may manual testing simply does not scale well Bj Rollison is a test architect with
have been “good enough” in the past. to the increasing size and complexity of Microsoft’s Engineering Excellence group,
But, as software permeates virtually software, and is unproductive in relation where he designs and develops the technical
every aspect of our lives, it is imperative to the number of resources. training curriculum in testing methodologies
and test automation.
for commercial software companies to Of course, the overall effectiveness of

42 • Software Test & Performance SEPTEMBER 2008


A LT E R N AT I V E T H I N K I N G A B O U T Q U A L I T Y M A N A G E M E N T S O F T WA R E :

Make Foresight 20/20.


Alternative thinking is “Pre.” Precaution. Preparation. Prevention.
Predestined to send the competition home quivering.

It’s proactively designing a way to ensure higher quality in your


applications to help you reach your business goals.

It’s understanding and locking down requirements ahead of


time—because “Well, I guess we should’ve” just doesn’t cut it.

It’s quality management software designed to remove the


uncertainties and perils of deployments and upgrades, leaving
you free to come up with the next big thing.

Technology for better business outcomes. hp.com/go/quality

©2008 Hewlett-Packard Development Company, L.P.

Você também pode gostar