SlideShare a Scribd company logo
1 of 11
Bean Shell Scripting in
Apache JMeter
NAVEENKUMAR NAMACHIVAYAM
Founder – QAInsights.com
http://QAInsights.com
Introduction to Beanshell
• BeanShell is a Java-like scripting language, invented by Patrick Niemeyer.
• Pure Java
• Free
• Runs in the Java Runtime Environment and uses Java syntax
• BeanShell is small and embeddable, so you can call BeanShell from your Java applications to
execute Java code dynamically at run-time
• standalone BeanShell scripts to manipulate Java applications; working with Java objects and
APIs dynamically.
• Runs in four modes: Command Line, Console, Applet, Remote Session Server.
• With BeanShell you can create custom outputs, perform logical operations, manipulate
variables, etc.
Scripting Features
• Optionally typed variables.
• Scripted methods with optionally typed arguments and return values
• Scripted objects (method closures)
• Scripted interfaces and event handlers.
• Convenience syntax for working with JavaBean properties, hashtables, and primitive wrapper
types.
• Auto-allocation of variables to emulate Java properties files.
• Extensible set of utility and shell-like commands
• Dynamic classpath management including find grained class reloading
• Dynamic command loading and user command path
• Sophisticated namespace and callstack management
• Detailed error reporting
Bean Shell Sampler
• In order to manipulate and work on the response data, Bean Shell sampler would be a great
element.
• To add Bean Shell sampler, right click, Add > Sampler > Bean Shell Sampler.
Bean Shell Sampler
• In this example, user name will be retrieved and manipulated using Bean Shell sampler.
• If the username is not equal to NAVEENKUMAR NAMACHIVAYAM, then the thread will stop.
• Use Regular Expression Extractor to extract the username as shown below.
Bean Shell Sampler
• Once the username is extracted, add Bean Shell Sampler to manipulate.
• Here the username will be stored in username variable.
• To get the extracted value in Bean Shell sampler, use below syntax.
• String userName = vars.get("username");
• Next step is to check the condition using if statement.
• if (userName != "NAVEENKUMAR NAMACHIVAYAM")
• You can use Data set config file variable too, if you do not want to hard code the user name.
• Now, if the condition is true, following statement will be used to terminate the execution.
• SampleResult.setStopThread(true);
• Below statement will be used to return the value.
• return userName
Bean Shell Sampler
Bean Shell Sampler Output
Bean Shell Sampler – Some more enhancement
• To print the output to command prompt, you can use
• System.out.println statement
• System.out.println("Response Code is " + ResponseCode);
• System.out.println("Response Message is " + ResponseMessage);
• if (SampleResult.isSuccessful())
• {
• System.out.println("Success");
• SampleResult.setStopTest(true);
• SampleResult.setStopThread(true);
• }
Bean Shell Sampler – Some more enhancement
Thank you
Please visit http://qainsights.com/services for more training programs.

More Related Content

What's hot

Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with JestMichał Pierzchała
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.Andrey Oleynik
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017Amazon Web Services Korea
 
Performance testing using jmeter
Performance testing using jmeterPerformance testing using jmeter
Performance testing using jmeterRachappa Bandi
 
Chaos Engineering for Docker
Chaos Engineering for DockerChaos Engineering for Docker
Chaos Engineering for DockerAlexei Ledenev
 
Performance testing : An Overview
Performance testing : An OverviewPerformance testing : An Overview
Performance testing : An Overviewsharadkjain
 
Performance testing with JMeter
Performance testing with JMeterPerformance testing with JMeter
Performance testing with JMeterMikael Kundert
 
Performance testing using Jmeter for apps which needs authentication
Performance testing using Jmeter for apps which needs authenticationPerformance testing using Jmeter for apps which needs authentication
Performance testing using Jmeter for apps which needs authenticationJay Jha
 
Test Automation Framework Designs
Test Automation Framework DesignsTest Automation Framework Designs
Test Automation Framework DesignsSauce Labs
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkMicha Kops
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With JmeterAdam Goucher
 
Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs JmeterAtul Pant
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With JestBen McCormick
 
Test Automation Architecture
Test Automation ArchitectureTest Automation Architecture
Test Automation ArchitectureApplitools
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Frameworkvaluebound
 

What's hot (20)

Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
AWS 클라우드 기반 게임 아키텍처 사례 - AWS Summit Seoul 2017
 
Performance testing using jmeter
Performance testing using jmeterPerformance testing using jmeter
Performance testing using jmeter
 
Chaos Engineering for Docker
Chaos Engineering for DockerChaos Engineering for Docker
Chaos Engineering for Docker
 
Performance testing : An Overview
Performance testing : An OverviewPerformance testing : An Overview
Performance testing : An Overview
 
Performance testing with JMeter
Performance testing with JMeterPerformance testing with JMeter
Performance testing with JMeter
 
Cucumber BDD
Cucumber BDDCucumber BDD
Cucumber BDD
 
HP ALM QC
HP ALM QCHP ALM QC
HP ALM QC
 
Performance testing using Jmeter for apps which needs authentication
Performance testing using Jmeter for apps which needs authenticationPerformance testing using Jmeter for apps which needs authentication
Performance testing using Jmeter for apps which needs authentication
 
Test Automation Framework Designs
Test Automation Framework DesignsTest Automation Framework Designs
Test Automation Framework Designs
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured framework
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With Jmeter
 
Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs Jmeter
 
Hack like a pro with burp suite - nullhyd
Hack like a pro with burp suite - nullhydHack like a pro with burp suite - nullhyd
Hack like a pro with burp suite - nullhyd
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Test Automation Architecture
Test Automation ArchitectureTest Automation Architecture
Test Automation Architecture
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 

Viewers also liked

Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeterjvSlideshare
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance TestingAtul Pant
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in JmeterViviana Lesmes
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...Positive Hack Days
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeterBhojan Rajan
 

Viewers also liked (11)

Installing Groovy engine in Apache Jmeter
Installing Groovy engine in Apache JmeterInstalling Groovy engine in Apache Jmeter
Installing Groovy engine in Apache Jmeter
 
Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeter
 
Jmeter Performance Testing
Jmeter Performance TestingJmeter Performance Testing
Jmeter Performance Testing
 
How to Analyze Reports in Jmeter
How to Analyze Reports in JmeterHow to Analyze Reports in Jmeter
How to Analyze Reports in Jmeter
 
Tasks
TasksTasks
Tasks
 
Timers in Apache JMeter
Timers in Apache JMeterTimers in Apache JMeter
Timers in Apache JMeter
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
How to start performance testing project
How to start performance testing projectHow to start performance testing project
How to start performance testing project
 
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...
Автоматизация нагрузочного тестирования в связке JMeter + TeamСity + Grafana ...
 
Performance testing jmeter
Performance testing jmeterPerformance testing jmeter
Performance testing jmeter
 
Algorithm Class is a Training Institute on C, C++, CPP, DS, JAVA, data struct...
Algorithm Class is a Training Institute on C, C++, CPP, DS, JAVA, data struct...Algorithm Class is a Training Institute on C, C++, CPP, DS, JAVA, data struct...
Algorithm Class is a Training Institute on C, C++, CPP, DS, JAVA, data struct...
 

Similar to Beanshell scripting in Apache JMeter

Bshmanual
BshmanualBshmanual
Bshmanual涛 相
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom DevelopmentGWAVA
 
Variables and User Input
Variables and User InputVariables and User Input
Variables and User Inputprimeteacher32
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React AppAll Things Open
 
Unit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introUnit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introMaurice De Beijer [MVP]
 
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical Discussion
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical DiscussionOracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical Discussion
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical DiscussionJoshua Johnson, MIS
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshopseleniumconf
 
Eureka Moment UKLUG
Eureka Moment UKLUGEureka Moment UKLUG
Eureka Moment UKLUGPaul Withers
 
Ansible Automation for Oracle RMAN / Apex Restores
Ansible Automation for Oracle RMAN / Apex RestoresAnsible Automation for Oracle RMAN / Apex Restores
Ansible Automation for Oracle RMAN / Apex RestoresAbhilash Kumar
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play FrameworkWarren Zhou
 
Data Evolution on HBase with Kiji
Data Evolution on HBase with KijiData Evolution on HBase with Kiji
Data Evolution on HBase with KijiWibiData
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Adam Kunicki
 
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用Amazon Web Services
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAlberto Molina Coballes
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5jakemallory
 
Connect 2014 JMP101: Java for XPages Development
Connect 2014 JMP101: Java for XPages DevelopmentConnect 2014 JMP101: Java for XPages Development
Connect 2014 JMP101: Java for XPages Developmentpanagenda
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action Alex Movila
 
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)Julien SIMON
 
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic BeanstalkDeploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic BeanstalkAmazon Web Services
 
Deploying MLlib for Scoring in Structured Streaming with Joseph Bradley
Deploying MLlib for Scoring in Structured Streaming with Joseph BradleyDeploying MLlib for Scoring in Structured Streaming with Joseph Bradley
Deploying MLlib for Scoring in Structured Streaming with Joseph BradleyDatabricks
 

Similar to Beanshell scripting in Apache JMeter (20)

Bshmanual
BshmanualBshmanual
Bshmanual
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom Development
 
Variables and User Input
Variables and User InputVariables and User Input
Variables and User Input
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React App
 
Unit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introUnit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma intro
 
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical Discussion
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical DiscussionOracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical Discussion
Oracle Cloud Compute - EBS 12.2.5 Vision Demo - Technical Discussion
 
Introduction to selenium_grid_workshop
Introduction to selenium_grid_workshopIntroduction to selenium_grid_workshop
Introduction to selenium_grid_workshop
 
Eureka Moment UKLUG
Eureka Moment UKLUGEureka Moment UKLUG
Eureka Moment UKLUG
 
Ansible Automation for Oracle RMAN / Apex Restores
Ansible Automation for Oracle RMAN / Apex RestoresAnsible Automation for Oracle RMAN / Apex Restores
Ansible Automation for Oracle RMAN / Apex Restores
 
Introduction to Play Framework
Introduction to Play FrameworkIntroduction to Play Framework
Introduction to Play Framework
 
Data Evolution on HBase with Kiji
Data Evolution on HBase with KijiData Evolution on HBase with Kiji
Data Evolution on HBase with Kiji
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)
 
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
深探-IaC-(Infrastructure as Code-基礎設施即程式碼-)-在-AWS-上的應用
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5
 
Connect 2014 JMP101: Java for XPages Development
Connect 2014 JMP101: Java for XPages DevelopmentConnect 2014 JMP101: Java for XPages Development
Connect 2014 JMP101: Java for XPages Development
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)
AIM361 Optimizing machine learning models with Amazon SageMaker (December 2019)
 
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic BeanstalkDeploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk
Deploy, Manage, and Scale Your Apps with OpsWorks and Elastic Beanstalk
 
Deploying MLlib for Scoring in Structured Streaming with Joseph Bradley
Deploying MLlib for Scoring in Structured Streaming with Joseph BradleyDeploying MLlib for Scoring in Structured Streaming with Joseph Bradley
Deploying MLlib for Scoring in Structured Streaming with Joseph Bradley
 

More from NaveenKumar Namachivayam

More from NaveenKumar Namachivayam (17)

Start up ideas - Search Engines for Apps
Start up ideas - Search Engines for AppsStart up ideas - Search Engines for Apps
Start up ideas - Search Engines for Apps
 
Interesting facts about IRCTC and Lessons for Performance Testers
Interesting facts about IRCTC and Lessons for Performance TestersInteresting facts about IRCTC and Lessons for Performance Testers
Interesting facts about IRCTC and Lessons for Performance Testers
 
Web service testing using QTP (UFT)
Web service testing using QTP (UFT)Web service testing using QTP (UFT)
Web service testing using QTP (UFT)
 
Types of performance testing
Types of performance testingTypes of performance testing
Types of performance testing
 
Internationalization Test Approach - Full Whitepaper
Internationalization Test Approach - Full WhitepaperInternationalization Test Approach - Full Whitepaper
Internationalization Test Approach - Full Whitepaper
 
Working faster MS Outlook Advance
Working faster MS Outlook AdvanceWorking faster MS Outlook Advance
Working faster MS Outlook Advance
 
Customizing Outlook MS Outlook Advance
Customizing Outlook MS Outlook AdvanceCustomizing Outlook MS Outlook Advance
Customizing Outlook MS Outlook Advance
 
Formatting Options MS Outlook Advance
Formatting Options MS Outlook AdvanceFormatting Options MS Outlook Advance
Formatting Options MS Outlook Advance
 
Contacts
ContactsContacts
Contacts
 
Message modifications MS Outlook Intermediate
Message modifications MS Outlook IntermediateMessage modifications MS Outlook Intermediate
Message modifications MS Outlook Intermediate
 
Email Enhancements MS Outlook Intermediate
Email Enhancements MS Outlook IntermediateEmail Enhancements MS Outlook Intermediate
Email Enhancements MS Outlook Intermediate
 
Journal and Notes
Journal and NotesJournal and Notes
Journal and Notes
 
Calendar
CalendarCalendar
Calendar
 
Organizing messages
Organizing messagesOrganizing messages
Organizing messages
 
Email Feature
Email FeatureEmail Feature
Email Feature
 
Messages - MS Outlook
Messages - MS OutlookMessages - MS Outlook
Messages - MS Outlook
 
Getting started with Outlook
Getting started with OutlookGetting started with Outlook
Getting started with Outlook
 

Recently uploaded

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Beanshell scripting in Apache JMeter

  • 1. Bean Shell Scripting in Apache JMeter NAVEENKUMAR NAMACHIVAYAM Founder – QAInsights.com http://QAInsights.com
  • 2. Introduction to Beanshell • BeanShell is a Java-like scripting language, invented by Patrick Niemeyer. • Pure Java • Free • Runs in the Java Runtime Environment and uses Java syntax • BeanShell is small and embeddable, so you can call BeanShell from your Java applications to execute Java code dynamically at run-time • standalone BeanShell scripts to manipulate Java applications; working with Java objects and APIs dynamically. • Runs in four modes: Command Line, Console, Applet, Remote Session Server. • With BeanShell you can create custom outputs, perform logical operations, manipulate variables, etc.
  • 3. Scripting Features • Optionally typed variables. • Scripted methods with optionally typed arguments and return values • Scripted objects (method closures) • Scripted interfaces and event handlers. • Convenience syntax for working with JavaBean properties, hashtables, and primitive wrapper types. • Auto-allocation of variables to emulate Java properties files. • Extensible set of utility and shell-like commands • Dynamic classpath management including find grained class reloading • Dynamic command loading and user command path • Sophisticated namespace and callstack management • Detailed error reporting
  • 4. Bean Shell Sampler • In order to manipulate and work on the response data, Bean Shell sampler would be a great element. • To add Bean Shell sampler, right click, Add > Sampler > Bean Shell Sampler.
  • 5. Bean Shell Sampler • In this example, user name will be retrieved and manipulated using Bean Shell sampler. • If the username is not equal to NAVEENKUMAR NAMACHIVAYAM, then the thread will stop. • Use Regular Expression Extractor to extract the username as shown below.
  • 6. Bean Shell Sampler • Once the username is extracted, add Bean Shell Sampler to manipulate. • Here the username will be stored in username variable. • To get the extracted value in Bean Shell sampler, use below syntax. • String userName = vars.get("username"); • Next step is to check the condition using if statement. • if (userName != "NAVEENKUMAR NAMACHIVAYAM") • You can use Data set config file variable too, if you do not want to hard code the user name. • Now, if the condition is true, following statement will be used to terminate the execution. • SampleResult.setStopThread(true); • Below statement will be used to return the value. • return userName
  • 9. Bean Shell Sampler – Some more enhancement • To print the output to command prompt, you can use • System.out.println statement • System.out.println("Response Code is " + ResponseCode); • System.out.println("Response Message is " + ResponseMessage); • if (SampleResult.isSuccessful()) • { • System.out.println("Success"); • SampleResult.setStopTest(true); • SampleResult.setStopThread(true); • }
  • 10. Bean Shell Sampler – Some more enhancement
  • 11. Thank you Please visit http://qainsights.com/services for more training programs.