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
2
votes
4 answers

jmeter grab value from response data

I have a question about grabbing a certain value from the html response data in Jmeter. I've been trying both regular expression and xpath extractor(see below) but having no luck. This is part of the response data I receive:
stenwolf
  • 311
  • 5
  • 13
1
vote
0 answers

Static method exists( sun.nio.fs.WindowsPath, java.nio.file.LinkOption ) not found in class'java.nio.file.Files'

I am working in Java 11.0.11 with Amazon Corretto. This code is running in a beanshell file as part of an identity governance system. I am trying to use java.nio methods with Windows network paths. I am able to create the path object using any…
Chris
  • 11
  • 2
1
vote
1 answer

How to use Sequential Each Occurrence in JMeter

I have a body data for a request where I need to pass values from CSV, but for every iteration I need to pass 2 values from file because it is having 2 occurrences of same variable Bodydata How can we pass 2 values for every run in JMeter. I need…
Mikey8997
  • 7
  • 2
1
vote
1 answer

"File f = new File("//Dev/Test")" in beanshellsampler JMeter

Trying to get the files from filepath using java.io.File "File f = new File("//DEV/Test")" in beanshellsampler JMeter configured in Jenkins, when try to get the absolute path, getting only "/Dev/Test". one '/' is missing. String folderPath =…
Kiran
  • 167
  • 2
  • 15
1
vote
1 answer

Beanshell won't load my dynamically added JDBC Driver class?

Using JDK1.6.0_16, I have this simple program where I am trying to get beanshell 2.0b4 to load a .jar dynamically (as the documentation suggests it will do) and I am having no luck. The documentation says that if I use beanshells' getClass()…
djangofan
  • 28,471
  • 61
  • 196
  • 289
1
vote
2 answers

JDBC connection with Beanshell

Other similar questions on StackOverflow didn't answer my question in this area. I have this script that doesn't work, and I am wondering how to get it to work: // beanshell script script.bsh import com.mysql.jdbc.Driver; import…
djangofan
  • 28,471
  • 61
  • 196
  • 289
1
vote
1 answer

Is it possible to access Beanshell objects from C#?

I have a C# application that's launched from beanshell code. Is it possible for this C# application have access to objects contained in the beanshell code? For example, in my beanshell code, I have an object A that contains a bunch of values that…
neo
  • 2,461
  • 9
  • 42
  • 67
1
vote
0 answers

execute eval string jshell beanshell

In most of scripting/interpreting programming languages such as python or JavaScript, there is/are a/some method(s) to execute a string in runtime just like a code. For example: eval("int i=5;"); those could have run the eval method inside the…
Maj
  • 29
  • 4
1
vote
1 answer

JMeter - Replace inline javaScript to BeanShell

I need to send elapsed time in header of each request. To do this I use inline javaScript in HTTP Header Manager as following: If there is any way to do the same with BeanShell instead of javaScript?
lyres
  • 115
  • 7
1
vote
2 answers

Jmeter - Inline evaluation error in Beanshell Assertion

I am getting this error, and cannot figure out what wrong I am doing: Error invoking bsh method: eval In file: inline evaluation of: ``import java.util.Set; import java.util.Map; import java.util.List; try { // Map . . . '' Encountered "String"…
V.Bhanderi
  • 47
  • 8
1
vote
1 answer

How to overwrite a column in CSV with JMETER before passing the editted csv as file upload to another API?

I have extracted a value from JSON response of an API with jmeter let's call it ${newID}. Now I want to paste this newID in all the values of a column ID2 (image attached for reference). Then I need to pass the updated CSV as part of file upload to…
A. A.
  • 11
  • 2
1
vote
1 answer

Jmeter Beanshell get value from JSON Extractor

I use JSON Extractor to get value from respond body. Then I want to get this value for Authorization to add to header to use for next http request . How can I get this value in Beanshell? enter image description here enter image description here
1
vote
2 answers

How do I write a sailpoint beanshell java script to read a latest file whose filename starts with ‘SampleFile***.csv’

I am trying to write a java in a beanshell where I need to read a file and rename them. But the problem is filename has appending number that changes everyday according to date, ex. SampleFile0521, SampleFile0524. And I need to read a File with…
1
vote
1 answer

Reading Request Cokkie in Jmeter Groovy

Below is the piece of code from Java Script(K6) that returns me Cookie. I am trying to do the same in JMeter Groovy language. let sso = JSON.stringify(response.request.cookies[`mygateid_sso`]); let authToken_regex = /{'authToken':'(\S+?)'}/; …
Vishal
  • 339
  • 1
  • 9
  • 26
1
vote
1 answer

JMeter(Bean Shell Sampler) + Git + Jenkins - Bean Sampler script not Reading the csv file

I have API tests created in Jmeter and committed to the GIT branch. All my JMeter tests executed from the Jenkins Pipeline job. ISSUE: In the Jmeter test, I am using a bean shell sampler that reads data from a CSV file. Refer to the below…
vignesh
  • 141
  • 1
  • 9