Useful JMeter functions for scripting

2,591 views

Published on

This is a small presentation to illustrate some of the basic JMeter functions/ features that can be used to accurately construct JMeter scripts

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,591
On SlideShare
0
From Embeds
0
Number of Embeds
286
Actions
Shares
0
Downloads
75
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Useful JMeter functions for scripting

  1. 1. JMeter FeaturesBy Tharinda Liyanage
  2. 2. XPath• XPath is used to navigate through elements and attributes in an XML document//form[@name=fm1]//input[@name=lt]/@value
  3. 3. XPath Extractor//form[@name=fm1]//input[@name=lt]/@value
  4. 4. • JMeter variable – ${t}
  5. 5. Regular Expression• Matches string patterns• input type="hidden" name="lt" value="(.*)" Reference Name: MYREF Regex: name="(.+?)" value="(.+?)" Template: $1$$2$
  6. 6. Reg Ex• ( ) - grouping• [ ] - character classes• { } - repetition• * + ? - repetition• . - wild-card character• - escape character• | - alternatives• ^ $ - start and end of string or line
  7. 7. Functions• __log()• __threadNum()- The thread number function simply returns the number of the thread currently being executed ${__log(${__threadNum},,,******Thread_Number is*********:: )}
  8. 8. • __machineName() The machineName function returns the local host name
  9. 9. • __RandomString ()RandomString(var1,var2,var3),where:var1 - Random string lengthvar2 - Chars to use for random string generationvar3 - Name of variable in which to store the result (optional)
  10. 10. • Counter
  11. 11. Database Testing• Step 1: Put downloaded JDBC driver (sqljdbc4.jar) under "JMeter/lib/" directory.• Step 2 : Adding JDBC Connection Configuration
  12. 12. • Step 3: Adding JDBC Request

×