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

[IMQA] performance consulting
[IMQA] performance consulting[IMQA] performance consulting
[IMQA] performance consultingIMQA
 
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...i-love-flamingo
 
Modern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.jsModern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.jsJonas Bandi
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmetertest test
 
Circuit Breaker Pattern
Circuit Breaker PatternCircuit Breaker Pattern
Circuit Breaker PatternVikash Kodati
 
Full stack web development
Full stack web developmentFull stack web development
Full stack web developmentCrampete
 
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern WebPlaywright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern WebApplitools
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on KubernetesBruno Borges
 
Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)Folio3 Software
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introductionejlp12
 
Building Microservices with Apache Kafka
Building Microservices with Apache KafkaBuilding Microservices with Apache Kafka
Building Microservices with Apache Kafkaconfluent
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioHassy Veldstra
 
Introduction to Apache Airflow
Introduction to Apache AirflowIntroduction to Apache Airflow
Introduction to Apache Airflowmutt_data
 

What's hot (20)

[IMQA] performance consulting
[IMQA] performance consulting[IMQA] performance consulting
[IMQA] performance consulting
 
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...
Flamingo Microservice based E-Commerce / Motivations,Backgrounds, Short Intro...
 
Modern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.jsModern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.js
 
Introduction to jmeter
Introduction to jmeterIntroduction to jmeter
Introduction to jmeter
 
Circuit Breaker Pattern
Circuit Breaker PatternCircuit Breaker Pattern
Circuit Breaker Pattern
 
Full stack web development
Full stack web developmentFull stack web development
Full stack web development
 
Playwright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern WebPlaywright: A New Test Automation Framework for the Modern Web
Playwright: A New Test Automation Framework for the Modern Web
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
 
Spring boot
Spring bootSpring boot
Spring boot
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
Single page application
Single page applicationSingle page application
Single page application
 
Building Microservices with Apache Kafka
Building Microservices with Apache KafkaBuilding Microservices with Apache Kafka
Building Microservices with Apache Kafka
 
Load-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.ioLoad-testing 101 for Startups with Artillery.io
Load-testing 101 for Startups with Artillery.io
 
Asp.net controls
Asp.net controlsAsp.net controls
Asp.net controls
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Introduction to Apache Airflow
Introduction to Apache AirflowIntroduction to Apache Airflow
Introduction to Apache Airflow
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Governor limits
Governor limitsGovernor limits
Governor limits
 

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
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With JmeterAdam Goucher
 
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 (12)

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
 
Performance Testing With Jmeter
Performance Testing With JmeterPerformance Testing With Jmeter
Performance Testing With 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
 

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
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 

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

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

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.