Monday, March 17, 2014

How to read multiple values in a single cell of .csv in Jmeter

In this blog post it is explained how to read a value from a .csv file via jmeter.

You have to follow the exact steps given in the blog post.

  • Apart form that, assume you have your csv file in the following format in the first cell it self and you need to read multiple values:


admin,password,admin@email.com,Ushani1,Balasooriya,IS47tenant1.com
admin,password,admin@email.com,Ushani2,Balasooriya,IS47tenant2.com
admin,password,admin@email.com,Ushani3,Balasooriya,IS47tenant3.com
admin,password,admin@email.com,Ushani4,Balasooriya,IS47tenant4.com





  • In Jmeter, you should right click on Thread Group and select Add --> Config Element ---> CSV Data Set Config.

  • Then provide the following information.


Filename = YOUR_CSV_FILE_LOCATION
File Encoding = 
Variable Names = username,password,email,firstname,lastname,tenantDomainName
Delimiter = ,        // this is to delimit entries in list, not variables
 
 
 
 
  • My sample call to create tenant will be written as follows :

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.mgt.tenant.carbon.wso2.org" xmlns:xsd="http://beans.common.stratos.carbon.wso2.org/xsd">  
   <soapenv:Header/>  
   <soapenv:Body>  
    <ser:addTenant>  
      <!--Optional:-->  
      <ser:tenantInfoBean>  
       <!--Optional:-->  
       <xsd:active>1</xsd:active>  
       <!--Optional:-->  
       <xsd:admin>${username}</xsd:admin>  
       <!--Optional:-->  
       <xsd:adminPassword>${password}</xsd:adminPassword>  
       <!--Optional:-->  
       <xsd:email>${email}</xsd:email>  
       <!--Optional:-->  
       <xsd:firstname>${firstname}</xsd:firstname>  
       <!--Optional:-->  
       <xsd:lastname>${lastname}</xsd:lastname>  
       <!--Optional:-->  
       <xsd:tenantDomain>${tenantDomainName}</xsd:tenantDomain>  
       <!--Optional:-->  
       <xsd:tenantId>0</xsd:tenantId>  
       <!--Optional:-->  
       <xsd:usagePlan>Demo</xsd:usagePlan>  
      </ser:tenantInfoBean>  
    </ser:addTenant>  
   </soapenv:Body>  
 </soapenv:Envelope>  



No comments:

Post a Comment