How to ensure server has sent emails in Jmeter - jmeter

I'm running a load test in jmeter for a registration scenario. In that scenario, there is a situation where an OTP is sent for the email address provided. Is there a way to ensure that the email has been sent when running the test script. All the email addresses i use are dummy addresses getting from a CSV file. I do not wish to read the email or get any data from it. I simply am required to know if the emails has been sent when a certain http request is hit.

I don't think you can "know if the emails has been sent" without actually receiving it so instead of "dummy" emails you can:
Set up a local mail server, i.e. test-mail-server or real email address(es)
Configure your application to use this test mail server (or real mail server) for sending emails
Configure JMeter to read emails from this test mail server using Mail Reader Sampler. Check out How to Create a JMeter Script to Check Email During Registration AND Grab the Confirmation URL article for more information.

Related

Unable to send email with Attachment in Jmeter: Response code:500 Response message:IOException while sending message

I am facing an issue while attaching a file in my SMTP sampler.
Below are the steps performed:
1-Writing the Summary Report results into a file/folder i.e D:/ABC/XYZ${__time(ddMMyyhhmmss)}.csv (It successfully write on that path)
2-Attaching the same file i.e D:/ABC/XYZ${__time(ddMMyyhhmmss)}.csv in my SMTP sampler against Attach file(s) field.
Now I Execute my Script and got this error.
Response code:500 Response message: IOException while sending message
And after that, when I don't attach any file. My script runs successfully.
One more thing I want to add. Earlier to this script, I was able to send the attachments too but those were from my Gmail account added in SMTP. And now I am doing it from my company's email account i.e. using outlook in SMPT sampler.
Please guide me in resolving the said issue.
Your ${__time(ddMMyyhhmmss)} will generate different results each second:
so you most probably need to amend:
first usage as ${__time(ddMMyyhhmmss,timestamp)}, this way the first function call will store the generated value into timestamp JMeter Variable
second, third, etc. as ${timestamp}
Outlook is an application which can access multiple mailboxes using various protocols like SMTP, POP, IMAP or Microsoft Exchange. JMeter supports first 3, but if your company is using MS Exchange as email transport - you won't be able to use SMTP Sampler, you will have to switch to JSR223 Sampler and write your mail sending code in Groovy using library like javaxt-exchange or EWS Java API

Jmeter sending email to simulate cjsm (secure) doesn't use Base64 encoding for attachment

I am trying to simulate email from a secure email account using Jmeter.
Any attachments that I send are not being encrypted using Base64 as the emails are when sent from the same email address manually. this is causing a problem whereby the application that picks up the attachment to process fails to decode the email.
How can I get Jmeter to submit the email with attachment with content-transfer-encoding of base64?
If all you need to do is to perform base64-encoding of the message body - you can perform it via __base64Encode() function available via Custom JMeter Functions bundle and can be installed using JMeter Plugins Manager.
However be aware that it can be easily decoded back even using online tools so I doubt that it makes sense to rely on Base64 for security.
You can always call underlying Java Mail API functions from JSR223 Test Elements if JMeter cannot fully fulfill your requirements.

Does Jmeter saves the randomly generated email id (pre-processor-user parameters) in the database

I have used Jmeter's pre-processor 'user parameters'to generate random email ids to test singup api, able to susscefully generate and signin. However not able to see the randomly generated email id in the database (using mongoDB), it is not stored in the DB.
Does jmeter saves the email id in the DB?
By default JMeter doesn't store anything into the database. If your API sign-up process assumes storing email of the signing-up person to the database - something is wrong with your test scenario.
JMeter automatically considers HTTP Status Codes below 400 as successful, it doesn't do any checks of the response body so my expectation is that you are receiving pseudo-successful responses having errors or exceptions inside. Add View Results Tree listener to your Test Plan - it is capable of visualizing request and response details and inspect them carefully. If there are errors - fix them until you will be happy with your script behavior, after that the listener can be disabled.
You can also use JMeter Assertions, i.e. Response Assertion to validate whether response contains message regarding successful sign up.
Don't forget to add HTTP Header Manager to send the relevant Content-Type header as some API servers don't process the requests not having expected MIME type.
See Testing SOAP/REST Web Services Using JMeter article for more information on APIs load testing.

Can I write a script which will send me message when there is heavy load on my server

when there is heavy load applied on my web application I must receive an email, If server is crashed or shutdown I can take necessary action it. How can I do it using jmeter when testing.
JMeter comes with SMTP Sampler which can send emails to individuals or groups. You can use it in conjunction with JMeter Assertions and If Controller, something like
"Normal Sampler" - i.e. HTTP Request
Assertion to check response code, duration, presence of some text, absence of errors, etc.
If Controller with the condition of ${JMeterThread.last_sample_ok}, special JMeter Variable which is true when previous sampler is successful and false otherwise
SMTP Sampler - to send an email
See Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article for example SMTP and Mail Reader samplers configuration

Customize OSB Mail alert body content

I am using Mail as alert-destination in OSB. From proxy service I am calling the alert destination and mail is being sent successfully.
However, the mail content is showing the details of service, destination, timestamp, server name etc details.
I just want to have the payload information in the mail body.
Is therey any way to customize the mail body when adding alert action in a proxy service?
Thanks in advance
The Alert action is very basic, and the email destination isn't really designed to be consumed by humans directly.
You're probably better off alerting to a JMS destination, then dequeuing it using a proxy to transform it into exactly what you want, then route to an SMTP Messaging business service to deliver the email (presumably formatted in HTML).

Resources