Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dgetzlaf opened this issue Oct 25, 2024 · 1 comment
Open

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

dgetzlaf opened this issue Oct 25, 2024 · 1 comment
Labels

Comments

@dgetzlaf
Copy link
Contributor

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]

@dgetzlaf
Copy link
Contributor Author

For example you can use this simple testplan:
Issue 6368.jmx.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants