Questions tagged [jsr223]

JSR223 (Scripting for the Java Platform) is the Java Specification Request for a common scripting engine abstraction layer.

JSR223 (Scripting for the Java Platform) is the Java Specification Request for a common scripting engine abstraction layer.

As an example (from the Java Scripting Programmer's Guide):

import javax.script.*;
public class EvalScript {
    public static void main(String[] args) throws Exception {
        // create a script engine manager
        ScriptEngineManager factory = new ScriptEngineManager();
        // create a JavaScript engine
        ScriptEngine engine = factory.getEngineByName("JavaScript");
        // evaluate JavaScript code from String
        engine.eval("print('Hello, World')");
    }
}

The interface to instantiate a scripting engine and evaluate a script is language-agnostic; "JavaScript" could be changed to "Python" to evaluate in Python (via Jython) rather than JavaScript (via Rhino).

434 questions
0
votes
1 answer

Advanced JMeter Looping

Let's say I have a user-defined paramater bodies which is a space-delimited list of arbitrary length. I need to create a loop of HTTP requests based on the length of bodies and use its content. For example if bodies=a b c, then I need to make a HTTP…
ejtt
  • 363
  • 3
  • 10
0
votes
1 answer

How to parse and save the response returned in logs for JSR223Sampler

I have a requirement to make a HTTP call using JSR223 sampler using Groovy as language. Upon making an api call i have received a response and is seen in log viewer. Now i want to parse and save the returned value in logs to a vaiable for successive…
Hari
  • 123
  • 1
  • 14
0
votes
1 answer

JMeter generate Signed AWS API Requests

I'm trying to generate a signed AWS request in JMeter. My first attempt was to put the same parameters, that work fine in my Postman requests, inside an HTTP Header Manager. Those parameters were "AccessKey", "SecretKey", "AWS Region", "Service…
Thomas
  • 63
  • 2
  • 9
0
votes
1 answer

Jmeter: iterate and increment with every request then go back

I have JDBC request that returns a string like: "this is an example". I want to be able to split that string by character (i.e: var_1=t, var_2=h, var_3=i, etc..) and the iterate them in a HTTP Request. Not only iterate, but increment the search…
isus hristos
  • 130
  • 1
  • 9
0
votes
0 answers

Parsing json objects(multiple) using groovy

I have below response as JSON: { "id":27, "merchant_id":"39", "title":"Shorts", "subtitle":null, "price":100, "description":null, "images":[ ], "image_thumbs":[ ], "options":[ { "code":"size", …
Siddish
  • 97
  • 3
  • 12
0
votes
1 answer

Unable to fetch value from Map in groovy

I have a JSON response like below { "id":27, "merchant_id":"39", "title":"Shorts", "subtitle":null, "price":100, "description":null, "images":[ ], "image_thumbs":[ ], "options":[ { "code":"size", "label":"Size", …
Siddish
  • 97
  • 3
  • 12
0
votes
1 answer

Obtaining the child values randomly in JSON

I have a JSON like below: I need to extract the Options -> Child as a Random and also Values within the options as randomly. How can we achieve in jmeter ? { "id":37, "merchant_id":"39", "title":"Parker…
Siddish
  • 97
  • 3
  • 12
0
votes
1 answer

Usage of nashorn javascript enigne along with jdk 1.6

My code is using rhino javascript engine in jdk 1.6/jdk 1.8 (with external rhino jars). Is there anyway I can implement nashorn javascript engine in jdk 1.6?
Madan Thunderfist
  • 193
  • 1
  • 2
  • 14
0
votes
1 answer

JSR223 sampler jmeter / Passing cookie data

I am trying to simulate a parallel ajax requests using a JSR223 sampler, as mentioned here https://www.blazemeter.com/blog/how-load-test-ajaxxhr-enabled-sites-jmeter But for my set of requests ,I am getting an error,Invalid API/Auth Key I assume it…
Tanmay Bhattacharya
  • 551
  • 1
  • 5
  • 16
0
votes
0 answers

Mongodb Aggregate query to groovy script

I am new to groovy scripting. I want to convert mongodb aggregate query to groovy script to query mongodb. Below is the mongodb query i want to change to groovy script: db.VERISK_METADATA_COLLECTION.aggregate([ { "$match":{contentType:"FRM"}}, {…
Jyotish
  • 13
  • 4
0
votes
1 answer

Java Engine Script which support Compilable

In continuing my question, Java uses Beanshell as script engine, while BeanShell Engine Script Compilable is not supported. Why java doesn't have script engine other than Beanshell that support Compilable ? can/should we override it? is there an…
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0
votes
1 answer

JMeter's JSR 233 - Edit option in language is irrelevant

In JMeter JSR 233 element There's an Edit option in language Combo box, If you leave empty it chooses by default groovy, but if you write engine name it's error prone and irrelevant because according to previous question drop down is being…
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0
votes
1 answer

when NOT to use Pre compilation in scripting?

I read about Pre compilation script and when you must compile script. I wanted to know if there are any cases where Pre compilation a script will cause script to fail or result in a wrong behavior ? or Pre compilation is always the right way when…
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0
votes
1 answer

Execute simple java file using jmeter

public static void main(String[] args) { String filename ="test.csv"; try { FileWriter fw = new FileWriter(filename); Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); Connection conn =…
0
votes
1 answer

JMeter add velocity language to JSR 223 Sampler

I want to use velocity language as Scripting language in JMeter's JSR 223 Sampler. According to the list velocity can be used in JSR223, According to the answer velocity should be added to JMeter classpath for discovery of available scripting…
Ori Marko
  • 56,308
  • 23
  • 131
  • 233