Questions tagged [beanshell]

Lightweight scripting for Java

From the official site:

BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript

943 questions
4
votes
2 answers

How to get the thread and the sampler name in JMeter

I want to get the thread and the sampler names in JMeter Test Plan and keep it in the variables. I already keep the Test Plan name using the BeanShell Post Processor: import org.apache.jmeter.services.FileServer; String testPlanName =…
Evgenii Truuts
  • 349
  • 1
  • 5
  • 17
4
votes
1 answer

How to use or escape java 8 Lambda expressions in Beanshell

I'm working on a Product (Sailpoint IdentityIQ that runs in Tomcat) which uses Beanshell env for product customization hooks. I want to write some code to parse a large csv file and want to leverage Java 8 Streams. But I'm facing issue with…
Madhu K
  • 43
  • 3
4
votes
2 answers

How to to extract response by XPath Extractor in JMeter?

I got the response like the following:
Hoàng Long
  • 10,746
  • 20
  • 75
  • 124
4
votes
2 answers

How to debug a beanshell script?

I have troubles to debug a beanshell script all I get all the time is: Exception invoking imported object method. : at Line: 194 : in file: inline evaluation of: ``import java.lang.reflect.InvocationTargetException; import java.util.Arrays; i . .…
Denis
  • 1,179
  • 10
  • 13
4
votes
1 answer

Great difference in Time Execution Groovy vs Beanshell

I'm interpreting a same script in both Groovy and Beanshell. Groovy takes a very long time(26 mins 25 secs), while Beanshell takes only 20 secs. I'm very astonished by the difference and I don't understand why, Is Beanshell is better? Am I using…
Mehdi Bouzidi
  • 1,937
  • 3
  • 15
  • 31
4
votes
4 answers

Jmeter: How to reuse custom java function between different JMX file

Requirement: Post response time of every sampler to Mongo DB, for that created an HttpClient java code(Class function). Problem: Need to call the custom (reuse same code between 150+ jmx file) Java function to be called from Beanshell after every…
Load Stitch
  • 167
  • 2
  • 11
4
votes
1 answer

How to generate random number using beanshell post processor in JMeter

I am trying to generate a random number using beanshell post processor but I am continuously getting an error "ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of: `` try {....." I am fetching the…
Naseem
  • 911
  • 5
  • 18
  • 48
4
votes
3 answers

How to Convert Json to Java Object in Jmeter

Our Requirement is we need to convert the Json response into Java object. May i know how to do it in Jmeter? Can we use Beanshell? Here is my sample response…
Kavinkumar Muthu
  • 99
  • 1
  • 5
  • 14
4
votes
1 answer

How to change child sample result to successful in jmeter?

I've made login process with the help of jmeter. In of of request samplers I'm expecting to get response code "401". I've added BeanShell Assertion if (ResponseCode.equals("401") == true) { SampleResult.setResponseOK(); …
neckobik
  • 307
  • 1
  • 6
  • 13
4
votes
1 answer

: Error invoking bsh method: eval Sourced file: inline evaluation of: ``

This is the code I'm trying to execute in beanshell sampler: import java.lang.*; import java.util.*; String name_lead = vars.get("Name_lead"); String[] lead =…
user6324058
4
votes
1 answer

Jmeter BeanShell Assertion not failing the tests

I am learning into Jmeter. I have a BeanShell Assertion which should make the tests fail (failure is hardcoded into the assertion). But all the tests pass. What am I doing wrong? My understanding is that if the BSA sets Faliure = true; the…
Androrider
  • 1,050
  • 2
  • 13
  • 20
4
votes
3 answers

Running a Beanshell pre-processor once in a test plan

I have a Bean shell preprocessor which ends up setting up some global variables like host name and the path according to the value that the user passes. The variables that the bean shell sets would be used by all the thread group. Currently i've…
AutomateFr33k
  • 562
  • 2
  • 8
  • 26
4
votes
1 answer

JMeter Adding Variables

I need to add four variables in JMeter and store them in another variable that I will be using for a later request (to be stored in the variable finalScore. I have a BeanShell PreProcessor with the following code: overallScore =…
Baljeet Bilkhu
  • 103
  • 1
  • 8
4
votes
2 answers

How to get the Response Message and Response Code when the Assertion Fails in jmeter

I am working on Webservice Testing using Jmeter.I am using Beanshell Assertion In this I am trying to display the Response Code and Response Message but the problem is when the Request Fails I am unable to get the response Code|Message displayed on…
RCBian
  • 1,080
  • 2
  • 20
  • 31
4
votes
1 answer

Beanshell script launched once (start and end of test plan) in JMeter

Good afternoon ! I will try to explain you clearly my problem. The context I have a JMeter TestPlan which send HTTP requests to a server. I have a Beanshell script to assert each different case of error returned. 302 response code -> OK 200…
Kapcash
  • 6,377
  • 2
  • 18
  • 40
1 2
3
62 63