You are on page 1of 58

IBM Software Group

Essentials of IBM Rational Performance Tester V8.0


Module 5: Managing Test Data

Copyright IBM Corp. 2005, 2009


Objectives: Managing Test Data
To use the built-in data management tools to
locate and manipulate data elements in
recorded tests
To locate static data captured in tests so that it
can be substituted with variable data to enable
realistic playback
To identify and trace automatic data correlation
through a recorded test to determine if it needs
to be altered

2
Where are we in the performance testing framework?

Test Planning Test Development


and Design and Validation
Record
RecordTransactions
Transactions
Workload
WorkloadAnalysis
Analysis Modify
ModifyTests
Tests
Performance
PerformanceTest
TestPlan
Plan Design
DesignWorkloads
Workloads
Validate
Validateand andDebug
DebugTests
Tests

Test
TestLab
LabHardware
Hardware Reset
ResetSystem
SystemandandData
DataState
State
System
SystemSoftware
Software Run Monitoring Tools
Run Monitoring Tools
Data
DataSet
Set Run
RunTests
Tests
Test
TestandandMonitoring
MonitoringTools
Tools Evaluate
EvaluateResults
Results
Set up Test Execute Tests and
Environment Gather Measurements

3
Topics: Managing Test Data
Modify recorded tests to more accurately
reflect transaction data
Select data to randomize
Create and connect datapools to tests
Evaluate the efficiency and accuracy of
automatic data correlation
Modify, remove, or add correlations as needed to
model transactions more accurately
Run and debug tests to ensure that
modifications are working properly

4
Test data management: Challenges
Need to minimize
tool overhead

Need to use
Want to test
as the tools in
realistically an efficient
as possible manner

Want to accurately
represent the users and
their transactions

5
Test data management: Scenarios
May need to be
Varied at runtime
Correlated
Some data may be interrelated
Some data may be dynamically generated and used
throughout a transaction
Generated (calculated)
Custom code
Could be satisfactory as recorded

6
Test data management: Types and tools

Data type Rational Performance


Tester
User Datapools

Application state Data correlation

7
Datapools
Framework used to vary
user data in a
transaction during test
execution
Provide variable data to
your tests during
execution
Used for user emulation
during test playback

8
Datapool elements
Record: A row of data. Rows are indexed
starting with zero.
Variable: A named data column. Data resides
in column cells and is typically typed based on
what is expected by the application-under-test.

9
Creating and using datapool data
Create small datapools on the fly
Datapool editor not efficient for inputting a large
amount of data
Import existing .csv files into the project to
create large data sets
Can add datapools to tests prior to creating
substitutions
Rational Performance Tester has no automatic
data generation tools

10
Add datapool to test prior to substitution

Select Test element in Test Editor


Click Add Datapool
Choose Datapool resource
Click Select

If in use, show go to
item in context menu

11
Data correlation
Mechanism used to manage dynamic data
within a transaction.
With a Web-based application, data is typically
returned in an HTTP response that is later
used in an HTTP request.
Rational Performance Tester identifies and
preserves these data relationships as they are
captured at recording time.
Correlated data items are:
Tagged as a REFERENCE
Linked to where they are used (SUBSTITUTION)

12
Example: Data correlation
Search operation based on variable input
Multiple links returned
Links differ between searches
Links differ over time
Login or account-based application
Session ID or dynamic handle is generated and
used throughout the transaction
Data is expected to be persistent throughout a
particular flow (transaction)

13
Inspecting test data
Inspect all datapool candidates
Determine which elements should be varied to
produce a valid test
Create references for anything not tagged that
needs to be datapooled
Inspect all data correlation references
Are they valid?
References can be cleared if not needed
Determine if they should be datapooled instead
No need to clear reference

14
Performance Test Editor: Data identification
Performance
Test Editor
settings
Highlights
data
correlation
and datapool
elements
Can be
customized

Window > Preferences > Test > Performance Test Editor > Colors and Fonts
15
Inspecting test data: HTTP pages
Highlight pages to see data or application attributes
that have been tagged for data correlation or
substitution
Press the down arrow to select the next page

16
Test data table: Page level
Show References: Display data elements
identified by test generation through a table
Show Locations: Position of data element in
Universal Resource Indicator (URI)

17
Data management visual aids: HTTP requests
Data correlation or datapool references within
page requests are highlighted and vary in color

Datapool candidates or
references, or correlated
data (green if both)
18
Data management visual aids: Test data
All test data elements are grouped by page

Data correlation
enabled

Datapool
Reference associated
candidate
with Datapool column

19
Data management visual aids: Page URL or data
Datapool references
Data correlation references
Data correlation
enabled

Reference associated Datapool


with Datapool column candidate
20
Data management visual aids: Response content

Display content from


a response by
pressing
CTRL+Space or
CTRL+Left Click
Not displayed by
default for efficiency
Left edge of content
box is a scroll bar
Colored lines indicate
references for easy
searching

21
Tool tips
Hover-activated tool tips provide detailed
information about many test elements.

22
Test search tool
In the Test Editor, right-click, and then click Test Search.
From the workbench, click Search > Search > Test Search.
Ctrl + H brings up the search dialog.

23
Test search tool: Search criteria
Type Search for text
Check boxes
Click Recursive
Choose Elements to
search
Custom options for each
type
Can search for HTTP
responses, pages, or
requests

24
Search view: Display result set

Double-click an item in Search view to expand


the test. The location and instances of the search
string are highlighted.
25
Modeling user test data
Realistic workloads vary user data
Correspond to input by user during
recording such as:
Form input
Selections
Located on next primary request
from page where entered
Focus on the important fields to the
application under test
Limit substitution to what is
necessary and efficient

26
Example: Data substitution

Request
GET /PlantsByWebSphere/login.jsp
Response
Web Browser

<form method="post"

HTTP Server
action="/PlantsByWebSphere/servlet/AccountServlet?
action=login&updating=false">
<input type="text" name="userid>

Request
POST
/PlantsByWebSphere/servlet/AccountServlet?
action=login&updating=false

userid= info@us.ibm.com

Datapool
27
Test data table: The datapool control panel

1. Datapooled
variable
2. Datapool
candidate
3. Select to
Datapool

28
Example: Creating a datapool substitution
1. Select target
Reference or
Datapool
candidate in the
Test Data table.
2. Click Substitute
From and then
click Datapool
Variable.

29
New datapool creation
An empty listing signifies
that there are no
datapools available.
Click Add Datapool.

30
New datapool creation (cont.)
Shared is the Open mode default
You can also choose Private, Segmented, and Wrapping
Fetch only once per user

Press F1 for
context help

31
New datapool creation (cont.)
Click Create Default.

32
New datapool creation (cont.)
Select the column you want to use.
Click Use Column.

Click to
select

33
New datapool creation (cont.)
Color coding changes from black to green for
easy recognition.
A substitution reference is created.

34
Existing datapool usage (nothing attached to test)
If the datapool is already available in the project, you
can add it to the test using the same procedure.

Do not click Create Default


Highlight existing datapool
Click Select

35
Existing datapool usage (attached to test)
If the datapool is
already added to the
test and the required
data column is in the
datapool, repeat the
procedure, select the
correct column, and
click Use Column.
If the column does not
exist, add it to the
current datapool
by clicking Add
Datapool (visible
only in correct context).
36
Tips for creating test data
Create enough data for all planned
transactions
Consider loops and multiple virtual users
Create enough data for all planned test runs; or
know how you will reset the system under test
Determine what data must be unique and
handle it appropriately
Randomly created data could generate test failures
or system errors

37
Editing datapools using the datapool editor
Open the datapool file.
Select a record or column header and right click for
the pop-up menu.

38
Importing a .CSV file to create datapools
Click File > New >
Datapool.
Specify destination
Project (and Folder if
desired).
Specify a unique File
name and then click
Next.

39
Importing a .CSV file to create datapools (cont.)
Specify the .CSV
file.
Specify if the first
row has column
names that could
be used as
variable names.
Generally, the
equivalence class
can be ignored.

40
Importing a .CSV file into existing datapool
Select Import from the context menu (or from menu File >
Import)
Select Datapool from import source. (Expand Test)
Browse for the csv file and select the datapool to
import into.

41
Exported datapool format
Export default datapool file
Add data
Preserve format
Import
Add to test
Variable Names
= Column
Names

Equivalence Class (Rational


Performance Tester_DATA::0) Data
needs to be repeated for each
row added to datapool

42
Topic Review: Datapools
1. How would you create a large datapool file?
2. Would you substitute datapool data for every
field in a Web form? Why or why not?
3. Should your datapools contain valid as well
as invalid data?

43
Exercise 5.1: Using Datapools
Scan a test looking for datapool candidates.
Create a substitution for the QTY field using a default datapool.
Edit the datapool and add a few rows.
Execute the test and determine if the datapool value was substituted
on playback.
Using a new place order test, datapool the userid and password
fields.
Locate field using the Search tool if you cannot find them.
Create a default datapool; do not add any data.
Export the datapool and add data manually (.CSV file).
Create a new datapool and import the updated .CSV file.
Attach the new datapool to the test.
Change the data substitution to select columns from the new
datapool.
Execute test and validate usage.
44
Data correlation: Modeling applications state data
Realistic workloads respond to dynamic
server responses.
Corresponds to dynamic data that changes for
each user or transaction
Value returned in earlier response used again in later
request
Located potentially in all requests
The tool generates an automatic set of
correlations to cover common usage in HTTP
applications
Incorrect or missing values can cause playback
to fail, or generate invalid workload for testing
45
Dynamic server data

Request 1
GET /PlantsByWebSphere/promo.html
Response 1
<a href=
Web Browser

HTTP Server
"/PlantsByWebSphere/servlet/ShoppingServlet?
action=productdetail&itemID=T0003">
Request 2
GET /PlantsByWebSphere/servlet/ShoppingServlet?
action=productdetail&itemID=T0003

Response 2
Bonsai product page

Tulips product page

46
Automatic data correlation settings
Window > Preferences >
Performance Test Generation

47
When data correlation goes wrong
Over Correlation
Problem: Data should not be dynamic
Solution: Remove Substitution or leave alone (but less
efficient)
Wrong Instance Correlation
Problem: Data is dynamic and correlated but uses wrong
part of response
Solution: Change correlation to use correct reference
Correct but Inefficient Correlations
Problem: Data is dynamic but there are several valid ways
to correlate; some solutions are more efficient than others
Solution: Automatically control in Test Generation
preferences

48
When data correlation goes wrong (cont.)
Under Correlation
Problem: Data is dynamic but was not automatically correlated
Solution: Find dynamic data and correlate to correct reference
Example #1: Parameters have different names
Response: customerId=12345..
Request: id=12345..
Solution: Search for instances of 12345 and identify correct
location for reference
Example #2: Value does not appear in test
Response: customerId=12345..
Request: customerId=12345May3105
Solution: Use custom code to generate computed value based
on customerId

49
Data correlation assistance
1. Show References to 2. Substituted 3. Select to find
see data correlation from Reference potential matches

50
Test editor: Trace data through the test
Double-click or Go To actions on many elements

51
Creating a reference
Field Reference versus Reference
Range of data
Specific value
Shortcut menus specify which operation can be used

52
Removing correlation at the page level
Select row in Test Data table
Right-click and click Remove Substitution
Or click Remove Substitution at the bottom of the
table

53
Removing correlation from request data
Select row in Test Data table
Double-click to jump to where the reference is
used (it will be highlighted by default)

Right-click to
remove
substitution

54
Removing a reference from response content
A reference supports data substitution in a subsequent
request.
If you clear a reference, any dependent substitutions
are removed automatically.

Right-click to
clear unused
reference

55
Topic Review: Data Correlation
1. If a performance test executes successfully,
can you assume the default data correlation
is correct?
2. How much do you need to know about an
application to validate data correlation in a
recorded test?
3. If you are unfamiliar with an applications
data relationships, how might you use
Rational Performance Tester to learn about
the application?

56
Exercise 5.2: Data Correlation
Create or use a test that orders a Bonsai tree
from the Plants by WebSphere home page.
Using the data correlation references and
navigational tools, perform the following tasks:
Locate the first place where the Bonsai Item ID is
used.
Locate the references that are linked to that data.
How many times is the reference used in the test?
Which test element contains the original
reference?
Are all of the linkages critical to the test executing
the transaction successfully?
57
58

You might also like