Тестирование производительности Ajax приложений с помощью JMeter, Владимир Примаков
В этом докладе будет раскрыт вопрос автоматизации тестирования производительности Ajax приложений с помощью бесплатного инструмента jmeter. Я расскажу об основных особенностях и трудностях автоматизации производительности Ajax приложений, о том, с какими конкретно проблемами я сталкивался и как они решались. Также я приведу ряд полезных советов, которые, возможно, облегчат вашу жизнь, если Вы вдруг решитесь провести тестирование производительности ajax приложений.
1. Performance Testing
AJAX Application with
JMeter
Vladimir Primakov
atdays.com
2. Agenda
AJAX
Main Difficulties of Performance Testing
of AJAX applications with jmeter and
their Solutions
Conclusions
Questions
atdays.com #atdays 2
3. Me
QA Manager at Kuadriga company.
3 years of continuous experience in automated
testing: IBM Rational Robot, Test Complete,
Selenium (RC), Jmeter.
Successfully applied server-side performance and
load testing on 4-5 different projects.
Enjoy photography, sports, and self-improvement
Profile in Linkedin:
http://www.linkedin.com/in/vladimirprimakov
Email: v.v.primakov@gmail.com
Skype: vladimir.primakov
atdays.com #atdays 3
4. AJAX – XMLHttpRequest + DHTML (HTML, CSS, Javascript)
AJAX - ASYNCHRONOUS JAVASCRIPT AND XML
atdays.com #atdays 4
6. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Web-server
Data store,
GUI backend
processing
atdays.com #atdays 6
7. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
processing
atdays.com #atdays 7
8. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
atdays.com #atdays 8
9. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
Web/ Data store,
XML/ backend
GUI JSON processing
server
atdays.com #atdays 9
10. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
JavaScript Web/ Data store,
call XML/
Ajax backend
GUI JSON
Engine processing
server
atdays.com #atdays 10
11. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
JavaScript Web/ Data store,
call XML/
Ajax backend
GUI JSON
Engine processing
XMLHttp
Request
server
object
atdays.com #atdays 11
12. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
JavaScript (XML)Http Request Web/
call
Data store,
Ajax http(s) transport XML/ backend
GUI JSON
Engine processing
XMLHttp
Request
server
object
atdays.com #atdays 12
13. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
JavaScript (XML)Http Request Web/
call
Data store,
Ajax http(s) transport XML/ backend
GUI JSON
Engine (XML) Http Response processing
XMLHttp
Request
server
object XML/JSON
atdays.com #atdays 13
14. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
HTML + javascript +
CSS data
AJAX
Browser Client Server Side
JavaScript (XML)Http Request Web/
call
Data store,
Ajax http(s) transport XML/ backend
GUI HTML+CSS JSON
Engine (XML) Http Response processing
XMLHttp
Request
server
object XML/JSON
atdays.com #atdays 14
15. Classic and Ajax Web-apps
Classic
Browser Client Server Side
Http Request
Web-server
Data store,
http(s) transport backend
GUI
Http Response processing
Size - Big
AJAX
Browser Client Server Side
JavaScript (XML)Http Request Web/
call
Data store,
Ajax http(s) transport XML/ backend
GUI HTML+CSS JSON
Engine (XML) Http Response processing
XMLHttp
Request
server
object
Size - Small
atdays.com #atdays 15
16. Classic
Request Response
Post HTML Page
atdays.com #atdays 16
17. Classic
Request Response
Post HTML Page
Request
AJAX JSON Response
Post Part of a page
a)
b)
atdays.com #atdays 17
30. UIDL Request (Post)
(Show Notifications window)
(UIDL) JSON Response
(Rendering Notifications window)
Element Type
Paintable ID
Arguments
atdays.com #atdays 30
31. MAIN DIFFICULTIES OF PERFORMANCE
TESTING OF AJAX APPLICATIONS WITH
JMETER AND THEIR SOLUTIONS
atdays.com #atdays 31
32. MAIN DIFFICULTIES OF PERFORMANCE
TESTING OF AJAX APPLICATIONS WITH
JMETER AND THEIR SOLUTIONS
atdays.com #atdays 32
33. MAIN DIFFICULTIES OF PERFORMANCE
TESTING OF AJAX APPLICATIONS WITH
JMETER AND THEIR SOLUTIONS
atdays.com #atdays 33
34. MAIN DIFFICULTIES OF PERFORMANCE
TESTING OF AJAX APPLICATIONS WITH
JMETER AND THEIR SOLUTIONS
atdays.com #atdays 34
35. Typical Performance/Load Testing Stages
Identify the Test Environment
Identify Performance Acceptance Criteria
Plan and Design Usage Scenarios
Implement the Usage Scenarios (Scripts)
Configure the Test Environment
Execute the Test
Analyze Results, Report, and Retest
atdays.com #atdays 35
36. Typical Performance/Load Testing Stages
Identify the Test Environment
Identify Performance Acceptance Criteria
Plan and Design Usage Scenarios
Implement the Usage Scenarios (Scripts)
Configure the Test Environment
Execute the Test
Analyze Results, Report, and Retest
atdays.com #atdays 36
37. Problems in Details:
Typical Ajax Applications
Unreadable Responses/Requests
Hard to find consistency between
Responses/Requests and GUI elements
Dynamic IDs
Sequential dependency between requests
atdays.com #atdays 37
38. Problems in Details:
Vaadin (UIDL) Ajax Applications
The same URL for most requests(Vaadin)
Dependency on Screen Resolution
(Vaadin)
Error requests are not evident (Vaadin)
Too many requests (Vaadin)
atdays.com #atdays 38
45. Hard to find consistency between
Responses/Requests and GUI elements
atdays.com #atdays 46
46. Hard to find consistency between
Responses/Requests and GUI elements
1. Use self-explanatory named IDs
(classes) for GUI elements
atdays.com #atdays 47
47. Hard to find consistency between
Responses/Requests and GUI elements
1. Use self-explanatory named IDs
(classes) for GUI elements
atdays.com #atdays 48
49. 2. Use Anchors
SAMPLE Scenario:
1. Create a ticket via email in the task management
system
2. Check that the ticket is created
3. Delete the ticket
atdays.com #atdays 50
50. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
atdays.com #atdays 51
51. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
atdays.com #atdays 52
52. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
3) Request to show tickets
atdays.com #atdays 53
53. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
3) Request to show tickets 4) JSON Response (Tickets page)
atdays.com #atdays 54
54. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
5) Checking whether the
ticket is created
3) Request to show tickets 4) JSON Response (Tickets page)
atdays.com #atdays 55
55. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
5) Checking whether the
ticket is created
3) Request to show tickets 4) JSON Response (Tickets page)
6) Extracting ticket ID (Regular Expression Extractor)
atdays.com #atdays 56
56. 1) Creating a ticket via email (SMTP Sampler) 2. Use Anchors
2) Login into the Ticket System
5) Checking whether the
ticket is created
3) Request to show tickets 4) JSON Response (Tickets page)
6) Extracting ticket ID (Regular Expression Extractor)
7) Request to Delete ticket
atdays.com #atdays 57
58. Dynamic IDs
Put Your application into the mode with
Static IDs (Don’t forget to restore this mode
every time you run scripts)
atdays.com #atdays 59
59. Dynamic IDs
Put Your application into the mode with
Static IDs (Don’t forget to restore this mode
every time you run scripts)
Set specific (debug) IDs for your GUI
elements
<h2 id=“AjaxPTproblems">
atdays.com #atdays 60
60. Dynamic IDs
Put Your application into the mode with
Static IDs (Don’t forget to restore this mode
every time you run scripts)
Set specific (debug) IDs for your GUI
elements
<h2 id=“AjaxPTproblems">
Use anchors
atdays.com #atdays 61
61. Sequential dependency between
requests
E.g.: IDs of all
If dynamic IDs are
tree elements used, sequential
changes every
time I make
dependency
changes to between requests
the tree
happens - it means
that previous actions
may influence next
actions and the order
of actions matters
atdays.com #atdays 62
63. Sequential dependency between
requests
Define definite initial data in the tested
application
Breakdown scenarios into undependable
chunks
atdays.com #atdays 64
64. Sequential dependency between
requests
Define definite initial data in the tested
application
Breakdown scenarios into undependable
chunks
Record scenarios from the beginning to
the end of the chunks
atdays.com #atdays 65
65. Sequential dependency between
requests
Define definite initial data in the tested
application
Breakdown scenarios into undependable
chunks
Record scenarios from the beginning to
the end of the chunks
Separate chunks using login/logout
(because initialization of IDs happens after
login)
atdays.com #atdays 66
67. The same URL for the most requests
(Vaadin)
Rename During Recording
Rename requests during traffic recording - at once as a certain
definite action is made by you in a web-browser.
atdays.com #atdays 69
68. Dependency on Screen Resolution
(Vaadin)
Screen coordinates are used while accessing these buttons
Define one screen resolution for your tests
and record traffic only for it
atdays.com #atdays 70
69. Error requests are not evident
(Vaadin)
The response code for Vaadin
“Out of Sync” and other
response Errors is still HTTP/1.1 200
atdays.com #atdays 71
73. Other Problems
Difficulty to make estimations
Script creation for (full) AJAX application takes ~
3-4 times more than for Classic application
atdays.com #atdays 75
74. Other Problems
Difficulty to make estimations
Script creation for (full) AJAX application takes ~
3-4 times more than for Classic application
Bad Supportability (Vaadin)
If application changes in most cases you have to
recreate the affected scenarios completely.
atdays.com #atdays 76