JMeter SMTP Sampler not triggering on Failure - jmeter

I have created a Thread Group and have 2 test sampler - Create Service and Create Project. I have added an SMTP Sampler to this Thread group and added an IF Controller with this script !${JMeterThread.last_sample_ok} But this SMTP Sampler is not triggering when I run the Thread group and there is a failure on Service Creation. what am I doing wrong here

If Controller expects the "condition" to be true or false, what you put resolves into !true hence it doesn't fire.
I would suggest considering switching to __jexl3() function like:
${__jexl3("${JMeterThread.last_sample_ok}" == "false",)}
More information: 6 Tips for JMeter If Controller Usage

Related

JMeter - Test not running on second call at run time

I have set my tests up in the following layout:
Test Plam
Test Fragment
EP-1(include controller)
EP-2(include controller)
EP-3(include controller)
Thread Group
Parameterized controller
Module Controller
EP1
Parameterized controller
Module Controller
EP2
Parameterized controller
Module Controller
EP1
Parameterized controller
Module Controller
EP3
View Results Tree
Results:
EP1
EP2
EP3
When running these tests i only get EP1 running once and doesn't run a second time (doesn't even look like it attempts to run)
No information in JMeter log apart from loaded (include controller)
I added the HTTP request directly and have the same issue so did the following set up:
Test Plan
Test Fragment
EP-1(include controller)
EP-2(include controller)
EP-3(include controller)
Thread Group
Parameterized controller
EP1
Parameterized controller
EP2
Parameterized controller
EP1
Parameterized controller
EP3
View Results Tree
Still got the same result. Any ideas?
New:
OUTPUT of this is:
JWT Token
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (PUT)
Include Controller1 (PUT)
HTTP Request (GET)
Include Controller1 (PUT)
Expected:
JWT Token
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (PUT)
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (GET)
Include Controller1 (PUT)
HTTP Request (GET)
Include Controller2 (GET)
I cannot reproduce your issue using latest stable JMeter 5.2.1 and your test plan structure with simple single Dummy Samplers under the Test Fragment in the each included file.
I configured the included Samplers to display current Thread Group iteration using __threadGroupName() and __V() functions combination like:
${__V(__jm__${__threadGroupName}__idx,)}
and as you can see everything is executing just fine:
Turns out the Cache Manager was caching the (GET) request (checkbox)
unchecked that and it worked.
Hopefully this helps anyone having a moment when writing these tests and unable to work out why the following (GET) requests are not being excuted.

JMeter HTML report - HTTP requests named <name>-0, <name>-1 <name>-2 etc - Why?

I have two thread groups in my project, and on of them has two HTTP request samplers. It's set up like the following
Thread group
Timer: Random between 1 and 5 minutes: ${__Random(60000,300000)}
HTTP request: A basic GET web service call
HTTP request: A basic GET web service call
Here's the Thread group setup.
That's it. Here's an example of the web service call setup
And here's what the "Statistics" portion of the HTML report looks like. Note the -1, -2 after the HTTP Request names. I'm trying to figure out why that's happening.
My other thread group / samplers are not displaying that way, but they're set up the same way, as far as I can tell.
In your example, HTTP requests Get Locations-0, Get Locations-1 are sub requests of Get Locations which appeared since you have selected the check box - Follow Redirects.
In case, you don't want HTTP requests Get Locations-0, Get Locations-1 to appear in your HTML report:
In the listener page(where you have saved the result file; which is the source file of HTML report) -> click on configure button -> uncheck the Save Sub Result option
You can also refer :Configure result file to customize HTML report
Turns out that some of the calls were returning a 200, others a 301, that's where they got separated out, even though the 301's didn't register as errors in the report.

How to user variable form webdriver sampler in HTTP Header Manager

I am able to extract auth_key from session storage .
I want load an API with auth_key in HTTP Header Manager
How can this be done.
var foo = WDS.browser.executeScript("return window.sessionStorage.getItem('ngStorage-jwtToken');")
var obj = JSON.parse(foo);
vars.put("auth",obj.oauth_token)
WDS.log.info(vars.get('auth'))
And I want to use auth as global variable to access on all threads.
Replace this line:
vars.put("auth",obj.oauth_token)
with this one:
WDS.vars.put("auth",obj.oauth_token)
Add HTTP Header Manager as a child of the request which header you need to amend and configure it like:
See General Concepts section of the WebDriver Sampler user manual entry to learn what pre-defined variables are available for the scripting.
Sdd HTTP Header Manager in scope with name auth_key and value ${auth}.
${auth} will be updated with the value from webdriver sampler.

Jmeter Module Controller - Response Assertion Ignored

In a test Fragment add a Simple Controller
In the Simple Controller Add add a request
In a Module Controller reference that simple controller
Add a Response Assertion within the module
The Response Assertion is Ignored.
Is this a normal behavior ? If yes, you shouldn't be able to add a Response Assertion.

Jmeter Clear cookies after each http request

In jmeter context, is there any way to clear cookies after each http request within the same thread group?
Why in that case you need HTTP Cookie Manager at all? Just remove it and you'll get expected behaviour.
Just in case you have some form of weird negative test scenario:
Add a Beanshell Listener or Beanshell Assertion at the same level with all HTTP Request samplers
Put the following code into "Script" area
import org.apache.jmeter.protocol.http.control.CookieManager;
CookieManager manager = ctx.getCurrentSampler().getProperty("HTTPSampler.cookie_manager").getObjectValue();
manager.clear();
See the following reference material:
JMeterContext class JavaDoc (referenced as ctx in the above script)
CookieManager class JavaDoc
How to Use BeanShell: JMeter's Favorite Built-in Component

Resources