PPTX - Vivit

advertisement
JavaScript testing –
faster and easier
using HP TruClient
Wilson Mar, HP Architect / Developer Advocate
Shlomi Nissim, HP R&D Manager
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Agenda
Faster and Easier JavaScript Testing
• You’re not alone
• Dive right in
• Approach
• Additional Resources
• Question & answer
2
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
TruClient introduction summary video
http://www.youtube.com/watch?v=AOWQEU8hAXI
2:16 minutes
(no voice narration, just music)
http://h20621.www2.hp.com/videogallery/us/en/d6b38cd914f8e534cdbf8025f076d2691779b562/r/video
3
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
=
HP LoadRunner 11.0 TruClient demo
http://www.youtube.com/watch?v=IuBxSbuNGDY
4
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
14:32 minutes
HP LoadRunner 11.50 - Tutorial: TruClient Firefox
http://www.youtube.com/watch?v=fZ8i9mke3tg
5
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
13:14 minutes
Support Matrix
LoadRunner 11.52 patch 1
OS
Browser
Win 7
FF 8.01*, IE 9, IE 10


Win 8
FF 8.01, IE 10


N/A
N/A


IE 9**
Win 2008 R2
FF 8.01, IE 9, IE 10
VuGen
Load Generator
* Firefox 8.01 is part of LoadRunner installation
** IE 9 is not supported on these operating system versions
6
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Support Matrix
LoadRunner 12.00
OS
Browser
Win 7
FF 22*, IE 9, IE 10


Win 8
FF 8.01, IE 10


N/A
N/A
IE 9**
VuGen
Load Generator
Win 2008 R2
FF 22, IE 9, IE 10


Win 2012
FF 22, IE 10


N/A
N/A
IE 9
* Firefox 22 is part of LoadRunner installation
** IE 9 is not supported on these operating system versions
7
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Multiple interface options
8
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Approach and strategy
Generate Script
1.
2.
User process, object identification, error detection
Configuration (for mobile, etc.)
Enhance Script
3.
Set Run Config.
4.
5.
6.
Flow control, Alternative steps, Function
Libraries
Transactions & Profiling
Data
and Parametization
Data Correlation
value variations
Single-User Runs
7.
8.
Logging for troubleshooting
Files download
Multi-User Runs
9.
Analyze capacity from load test runs
Explore
9
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Agenda
Browsers
High level functionality overview
Object Identification
Steps synchronization
Mobile
10
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Browsers
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Firefox is included within LoadRunner
12
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Static version of Firefox
Alt+H
13
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Do not open this
dialog. It will cause
automatic update
of Firefox
Internet Explorer 9 or above is a prerequisite
TruClient enforces
standards mode.
Quirks is not
supported
14
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Getting started
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Create a new script
16
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
TruClient recording
17
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Integrated with Mozilla Firefox
Async is a none
issue in TruClient
18
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Recording and script generation is interactive
19
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
TruClient Toolbox drag and drop
20
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Random wait calculation in JavaScript arguments
21
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Data Parameters
Use
LR.getParam("URL
"); to get the value
22
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Data Parameter reference in JavaScript
23
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Transactions
24
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Function libraries
Modularity and
code sharing
Function Reuse and Sharing
•
•
•
Create Functions library
Create functions
Call Functions from every script
Function Editing
•
•
25
Select library and function
Set function arguments
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Event handlers
26
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Settings
27
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Snapshots
28
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
TruClient Custom Functions
29
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Additional features added in LoadRunner 12.00
Shunra integration
Rendezvous
Virtual Table Server JavaScript API
Web page diagnostics*
IP spoofing*
Modem speed emulation*
* New in TC IE. Existed in TC Firefox
30
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Object Identification
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Object identification methods in TruClient
JavaScript
TruClient patented
algorithm
Custom
32
You can write code
that will locate the
object in the
document
Electors
XPath
You can write your
own Xpath or use the
automatically
generated suggested
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Automatic Electors
HP LoadRunner VuGen11.52
33
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Dynamic object identification Assistant
34
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Related object
Use related object to apply unique identification
35
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Modify step levels might fix issues while
running
HP LoadRunner VuGen11.52
36
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
XPath
Initial values provided
Multiple suggestions
Keep in mind Xpath method is static
For dynamc XPath (e.g. using parameters) use
evalXPath option in the JavaScript id method
37
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Pick item from list using XPath
38
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Use DOM Inspector for complex XPath
Locate the elements
on the page, the tree
will open
39
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
JavaScript
Important when identification requires logic (e.g.
parameterize)
Initial value provided based on evalXPath of first Xpath
suggested
The last statement is what’s returned and used by the step
JS function has a separate variable context from the script
itself
Access variable in script using ArgsContext.a for variable a
and ArgsContext.LR.getParam(“a”) for parameter a.
40
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
JavaScript
Record interaction with several options (e.g. radio buttons, table
cells)
Compare the Xpath values of the different objects and find the
common XPath
Change ID Method to Javascript and use evalXPath to get an array
of objects:
options=evalXPath("//div[@id=\"module-options-div\"]/div/div[2]/input");
Referance the array of objects to parameterize the object:
random(options) – select a random item
random(ArgsContext.item) – select an item based on the variable item
random(ArgsContext.LR.getParam(“item”)) – select an item based on the parameter item
41
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Steps Synchronization
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Automatic step end events
43
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Replay events
HP LoadRunner VuGen11.52
44
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Replay step synchronization guidelines
If there are no failures, stick with defaults.
Make changes only if
• The script is not running correctly
• To measure transaction response time using different end events
(and you know what you are doing )
Possible workarounds:
•
•
•
•
•
45
Change end event
Increase object timeout
Increase step timeout
Increase network timeout (in RTS)
Add wait steps
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Run-time Settings for replay
HP LoadRunner 11.52 VuGen TruClient script
46
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Step timeout
47
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Object sync checkpoints
HP LoadRunner VuGen11.52
48
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Transaction profiling
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Profiler
50
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Profiler
51
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
TruClient to Web(HTTP/HTML)
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
12.00 new feature – TC2Web
53
Powerful
Elegant
Small footprint, low cost
Real UI operation
Not real Web UI operation
Big footprint, high cost
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
12.00 new feature – TC2Web
Powerful, generate high stress to AUT
Have UI operation test
Low cost
54
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
12.00 new features – TC2Web
Internet
LoadRunner
Web protocol
recording proxy
TruClient
http
traffic
Browser
Web protocol
script
LR http server
55
TC
Event
Tc2Web addin
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Mobile device configuration
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Recording mobile
Mobile
device
Same User Agent
in Firefox >
TruClient
Ajax
App web
server
HP LoadRunner VuGen 11.51+
57
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Devices with User Agent strings
Count: 27
(LR 11.52)
HP LoadRunner VuGen11.52
58
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
User Agent string example
Sample User Agent for Samsung Galaxy S3
720 x
1280
Mozilla/5.0 (Linux; U;
Android 4.0; xx-xx;
GT-I9300
Build/IMM76D)
AppleWebKit/534.30
(KHTML, like Gecko)
Version/4.0 Mobile
Safari/534.30
More at http://www.useragentstring.com/
HP LoadRunner VuGen11.52
59
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Mobile Device Manager Tool
60
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Thank you
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Q&A
hp.com/go/loadrunner
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Standing by
• hp.com/go/education
• hp.com/go/hpswsupport
• hp.com/go/hpswprofessionalservices
© Copyright 2014 Hewlett-Packard Development Company, L.P.
63
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Downloads and sales
• hp.com/go/performancecenter
• hp.com/go/loadrunner
Conference
• hp.com/go/discover
© Copyright 2014 Hewlett-Packard Development Company, L.P.
64
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Social media
• hp.com/go/lrblog
• twitter.com/hploadrunner (@HPLoadrunner)
• facebook.com/groups/HPLoadRunner
• linkedin.com/groups/LoadRunner-69884
• linkedin.com/groups?gid=4539324 (TruClient)
© Copyright 2014 Hewlett-Packard Development Company, L.P.
65
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Forums
• hp.com/go/lrpc
• hpln.hp.com/group/community-content-pc-lr
• hpln.hp.com/group/performance-center-andloadrunner
• vivitworldwide.siteym.com/members/group.aspx?id=117871
© Copyright 2014 Hewlett-Packard Development Company, L.P.
66
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Additional Resources
HP LoadRunner page
www.hp.com/go/loadrunner
Join the buzz!
www.hp.com/go.lrblog
67
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Download