useful jmeter functions for scripting

13
JMeter Features By Tharinda Liyanage

Upload: tharinda-liyanage

Post on 28-Nov-2014

1.803 views

Category:

Documents


2 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Useful JMeter functions for scripting

JMeter Features

By Tharinda Liyanage

Page 2: Useful JMeter functions for scripting

XPath• XPath is used to navigate through elements and attributes in an XML

document//form[@name='fm1']//input[@name='lt']/@value

Page 3: Useful JMeter functions for scripting
Page 4: Useful JMeter functions for scripting

XPath Extractor

//form[@name='fm1']//input[@name='lt']/@value

Page 5: Useful JMeter functions for scripting

• JMeter variable – ${t}

Page 6: Useful JMeter functions for scripting

Regular Expression

• Matches string patterns

• input type="hidden" name="lt" value="(.*)"

Reference Name: MYREF Regex: name="(.+?)" value="(.+?)" Template: $1$$2$

Page 7: Useful JMeter functions for scripting

Reg Ex

• ( ) - grouping • [ ] - character classes • { } - repetition • * + ? - repetition • . - wild-card character • \ - escape character • | - alternatives • ^ $ - start and end of string or line

Page 8: Useful JMeter functions for scripting

Functions• __log()• __threadNum()- The thread number function simply returns the number of the thread currently being

executed ${__log(${__threadNum},,,******Thread_Number is*********:: )}

Page 9: Useful JMeter functions for scripting

• __machineName() The machineName function returns the local host name

Page 10: Useful JMeter functions for scripting

• __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)

Page 11: Useful JMeter functions for scripting

• Counter

Page 12: Useful JMeter functions for scripting

Database Testing• Step 1: Put downloaded JDBC driver (sqljdbc4.jar) under "JMeter/lib/" directory. • Step 2 : Adding JDBC Connection Configuration

Page 13: Useful JMeter functions for scripting

• Step 3: Adding JDBC Request