apache / apache/jmeter

Checkbox expression not evaluating for the `${__P(property_name)}` and `${variable_name}`

Open
#6,058 1 comment 0 reactions 0 assignees View on GitHub
defect
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

### Expected behavior

`Use Expression` feature in certain checkboxes in JMeter should evaluate `${__P(property_name)}` and `${variable_name}` value in GUI and CLI.

**Expected output for the below steps:**

```

<!doctype html>
<html>
<head>
<title>Example Domain</title>

<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>

<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>


GET

http://example.com/

<!doctype html>
<html>
<head>
<title>Example Domain</title>

<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

}
div {
width: 600px;
margin: 5em auto;
padding: 2em;
background-color: #fdfdff;
border-radius: 0.5em;
box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
div {
margin: 0 auto;
width: auto;
}
}
</style>
</head>

<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>


GET

http://example.com/

```

### Actual behavior

`Use Expression` feature in certain checkboxes in JMeter not evaluating `${__P(property_name)}` and `${variable_name}` value in GUI and CLI.

### Steps to reproduce the problem

1. Create a simple test plan with one HTTP sampler.
2. In `Test Plan` element, right click on `Functional Test Mode` and select `Use Expression` as shown below.

![image](https://github.com/apache/jmeter/assets/2826376/35487066-7cfe-462a-a2bf-806243854d7a)
3. Add `${__P(func_mode)}` in the editable checkbox field.

![image](https://github.com/apache/jmeter/assets/2826376/cfcb6193-8e66-4d73-a391-a013623ed585)

4. Save the test plan.
5. Add the following property in `jmeter.properties`
`jmeter.save.saveservice.output_format=xml`
6. Launch the command prompt.
7. Run the script with the below arguments.

`jmeter.bat -n -t .\use-expression-checkboxes-demo.jmx -f -l run.xml -Jfunc_mode=true`
8. Once the test is done. Open the run.xml.
9. It should have detailed response data. But it contains only the basic info.
```

http://example.com/

http://example.com/

```

Sample observation for `${variable_name}` as well. But `true` or `false` is working fine as it is enabling/disabling the mode.

### JMeter Version

5.6.2

### Java Version

openjdk version "11" 2018-09-25

### OS Version

Windows 11 22H2 22621.2070

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.