Save the local variable to global variable to use between threads and also automatically convert to HTML report

Srinivasa K P
2 min readMar 9, 2020

--

  1. Download latest jmeter apache file with jdk file (set java home file in environment system variables)
  2. open jmeter by bin jmeter.bat folder
  3. In testplan(projectname) add http request default to setup proxy → advanced →IP:localhost: port number:3128
Set company proxy server to use as default

4. under testplan create required auth post APIS in setup thread group

5. under each post call, add json extractor give variabe name (same use it for global reference as ‘$.access_token’) to save to local variable and beanshell postprocessor to save variable to gobal variable ${__setProperty(orgTokenId,${orgToken})} and this is way to interact with different thread group

Set local variable with json extractor
Set to global variable of stored local variable by bean shell post extractor for usage to between thread groups

6. To generate a automatic html reporter, first directly add simple data writer to test plan by giving file loaction to save csv file as ‘C:\Users\SRINIKP\Downloads\apache-jmeter-5.2.1\apache-jmeter-5.2.1\result.csv’ and it save by default afterwards,

set to default location to save csv file, it will auto save to csv file

7. Add teardown thread group to finally conver csv file to html report folder by default through beanshell sampler and writing jmeter CLI command to convert as html folder ‘Runtime.getRuntime().exec(
“C:/Windows/System32/cmd.exe /c jmeter -g C:/Users/SRINIKP/Downloads/apache-jmeter-5.2.1/apache-jmeter-5.2.1/result.csv -o C:/Users/SRINIKP/Downloads/apache-jmeter-5.2.1/apache-jmeter-5.2.1/report”);’

Set to run jmeter CLI command to convert as HTML report by using beanshell sampler

--

--

Srinivasa K P
0 Followers

Sr. Software Automation Engineer, and he has having experience in various frameworks such as BDD, TDD, Protractor, Selenium, Postman, Rest APIs etc…