Skip to content

Harmonize keys for bindings (i. e. JSR223-Elements) #6368

@dgetzlaf

Description

@dgetzlaf

Expected behavior

When shifting my test setup from JSR223Asstions to JSR223Listener (with the same groovy code) I can execute the same code without errors.

Code:

...
if (!vars.get("login_session")?.trim() && ctx.getCurrentSampler().getName().contains("0030_Do Authenticate")) {
    SampleResult.setResponseMessage("login_session not returned by step 0030")
    SampleResult.setSuccessful(false)
}
...

Actual behavior

When "blindly" shifting and executing the code I get the error:

ERROR o.a.j.v.JSR223Listener: Problem in JSR223 script, Handle Results
javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: SampleResult for class: Script28

When diving into the code, I noticed that sampleResult and SampleResult are used:
sampleResult in JSR223Listener and JavaScript
SampleResult in JSR223Sampler and JSR223Assertion

It would be nice to have the same bindings within all languages and elements (Groovy, Jexl, JavaScript, Assertions, Listeners, ...)

Steps to reproduce the problem

Run this code in JSR223 Assertion and in JSR223 Listener

if (!vars.get("login_session")?.trim() ) {
    SampleResult.setResponseMessage("login_session not returned by step 0030")
    SampleResult.setSuccessful(false)
}

JMeter Version

5.6.3

Java Version

openjdk version "21.0.2" 2024-01-16 LTS

OS Version

Microsoft Windows [Version 10.0.19045.5011]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions