Vairamuthu
Vairamuthu

Reputation: 568

How can I set dynamic parameters in jmeter?

enter image description hereenter image description hereenter image description here My scenario Step1: I have set http request for my variable and values are

     courseid = ${courseid}            
     priceid = ${priceid}                     
     coursecategoryid = ${coursecategoryid}..            
     .....etc         

    Step2: I have set my regular expression extractor is

    1) courseid

    Reference name: Courseid               
    Regular expression: courseid=(.+?)&          
    Template: $0$             
    Mathch No: 0                

    2)Price id              
    Reference name: Priceid                 
    Regular expression: priceid=(.+?)&                       
    Template: $0$                   
    Mathch No: 0     

    3)coursecategory id                       

    Reference name: Coursecategoryid               
    Regular expression: coursecategoryid=(.+?)&                  
    Template: $0$                 
    Mathch No: 0                  

    My result is showing below error in view result tree

http://192.168.2.41:8092/ecloudbaseweb//app/managecourseinfo?courseid=${courseid}&coursetitle=Maths&coursesubtitle=&coursedescription=Maths&coursegoal=Maths&coursepromevideopath=815%2Fpromovideo%2Ffile_19_Sep_2016_16_05_32_Promovideo.mp4&priceid=${priceid}&price=0&coursecategoryid=${coursecategoryid}

Kindly give me a solution for how can i using dynamic parameter for this scenario and kindly refer the snapshots

Upvotes: 0

Views: 16833

Answers (1)

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

I would recommend to follow these steps to find and fix the problem:

  1. Add Debug Sampler - to know which values are captured using regular expression extractor.
  2. If you are capturing more than one value from single response (using multiple groups), Follow the steps mentioned in the following post to check/confirm whether you are using regular expression in right manner: using Regular Expression Extractor to capture multiple values
  3. Run the script and check the debug sampler (in View Results Tree) for the values retrieved by Regular Expression Extractor

Note: Regular Expression Extractor should be added as a child of the sampler, in which response regular expressions should be applied.

Note: Reference names used in regular expression are case-sensitive.

Note: If a single group captures more than one value, then specify index which value to be used in the request. match 0 - random value, match n - value in 'n' index.

Eg: Suppose Regular expression: courseid=(.+?)& , captures more than one courseid from the response, then you need to specify the match to retrieve specific value. Check Debug Sample result to know the values captured using View Results Tree.

Edit:

As you are naming "Reference Name" as 'Courseid' but using it as '${courseid}', it won't match. Use '${Courseid}', i.e., upper case 'c'.

Reg Expr Extractor:

enter image description here

Usage:

enter image description here

Upvotes: 1

Related Questions