I've been trying to send my phpunit unit test report by email in my jenkins pipeline but i wasn't capable.
my test result is and xml file and when i tried converting it to html nothing informative was displayed. Is there any one who is familiar with this task ?
Related
I am facing below problem,Appreciate if any one help
I am having jenkin job which will trigger java jar contains code to read the email from excel and the same email to be passed in jenkins for sending email in username field.
Thanks
Did you take a look at parameterized jobs (If you want to manually trigger it)?
If, you want to read from excel and pass to another job please take a look at this.
I'm trying to understand your problem:
1. Jenkins to trigger emails to DevOps team that the deployment task results
2. Application to trigger emails that the application is being deployed successfully (Or any other scenarios you want to achieve, please indicate, and I will try to enhance this post)
If above is the case, you should try to utilize Jenkins to complete the full process: build, test, deploy and verify, then consolidate the results then send out via email
It's a clear cut that Jenkins for deployment and app for business
There are different ways to verify your application is deployed successfully depends on how you identify if app deployment is successful.
Jenkins can detect those signals, e.g. send a ping or curl to the application and verify the response
Now only Jenkins needs to know the list of emails address for the deployment results, you can use parameterized jobs as #Avneesh Srivastava mentioned
link for jmeteri am using jmeter for my testing. I am finding it hard to find a way to send an email to my account when an assertion fails. Or when the job is complete, i want the results sent to my email. How can i do that?
You can send an email with JMeter using SMTP Sampler. Something like:
If Controller, condition ${JMeterThread.last_sample_ok}==false
SMTP Sampler
See Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article for details on how to configure SMTP Sampler
Results can be send in the similar way.
Add the following line to user.properties file (lives in JMeter's "bin" folder)
jmeter.save.saveservice.autoflush=true
This is required to configure JMeter to save results into a file as soon as they're available in order to ensure you won't miss a single request results
Add tearDown Thread Group to your Test Plan. tearDown Thread group is being executed after all other Thread Groups
Add SMTP Sampler as a child of the tearDown Thread Group and configure it to send .jtl results file to the specified email(s)
I have incorporated a simple HTTP Request sampler in a test plan. And, viewing the result through "View Result Tree" and writing the same results to a file. I want this file to send through mail Sampler.
Issue is, once I execute the test-case, it sends mail first and then append new test results to the file. So, in mail I got the previous run results instead of the new one.
How can I incorporate this?
Reference Article - Send JMeter Test Reports Automatically in Email
If you use 'View Results Tree' or 'Summary Report' Listeners, you won't be able to send the current report, through mail via SMTP Sampler, even if you use tearDown Thread Group.
Reason : JMeter writes the data to these report files, only after the test is finished completely. You can verify this by adding a tearDown Thread Group and adding a delay before running the SMTP Sampler. Keep an eye on the file size, it is created once the test is started, but data is written when the last thread (SMTP Sampler, in this case) is finished execution.
Hence, only an empty file would be attached with your email.
Solution -
1. Find and modify (or add, if not present) the following section in the 'user.properties' file, setting the autoflush parameter to true:
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
jmeter.save.saveservice.autoflush=true
Use a batch script, and send the mail using some other utility after your JMeter Test, as suggested by Ashish.
Problem with this approach is, there is a dependency on another utility. Also, we would require to write different scripts for different platforms (Windows/Linux).
Instead of using default in-built JMeter plugins, we can use jp#gc JMeter Plugins, which provides very powerful reporting elements.
In this case, what we need is a 'Flexible File Writer' Plugin. It provides you powerful customization to configure what data you want to write to your report file, and also it would allow you to include complete report file to be sent via SMTP Sampler.
I was able to achieve this using Flexible File Writer Listener, and tearDown Thread Group. Here is the structure of my Test Plan -
Test Plan
--- Thread Group
-------Sampler
-------jp#gc- Flexible Filw Writer
---tearDown Thread Group
------SMTP Sampler
Here is a snapshot of my File Writer Plugin's configuration :
You may want to add some delay before sending the mail from tearDown Thread Group.
You can download the Flexible File Writer plugin using in-built Jmeter's Plugin Manager, or from JMeter Plugins Site - jp#gc Flexible File Writer Plugin
I observe that JMeter first sends the Email with either blank or old run report when doing it using the SMTP Sampler.
To overvome it, this is what I tried:
I created a batch file to call the Jmeter from command line as:
call jmeter -n -t "script path" -l "JTL report path"
I used a utility called sendEmail which is available in below location:
http://caspian.dotconf.net/menu/Software/SendEmail/
as:
sendEmail -f Sender_Email -t Receiver_Email -cc CC_Email -s Mail_Server -u "Subject" -m "Email body" -a "Path of JTL Report attachment"
What it is doing that it executes the JMeter script, generate the report in path specified in first step and then send Email with the report using step 2.
It might help.
I would suggest sending your email in tearDown Thread Group which is designed for post processing purposes and seems to be exactly what you're looking for.
Also make sure that you wait for reasonable amount of time via Test Action sampler as JMeter doesn't update results file on the fly, it periodically flushes chunks of results.
If you don't want "old" data you can use setUp Thread Group with i.e. OS Process Sampler to delete old results file or move it somewhere else.
For more JMeter email tips and tricks see Load Testing Your Email Server: How to Send and Receive E-mails with JMeter
I am currently creating reports with Eclipse embedded Report Designer for BIRT reports. In my next step, I would like to schedule this reports in such a way:
It will run once per day on a set time.
It will be produced as PDF.
It will be sent by email to a concrete email address.
I am working on Windows. Is it possible to do all of that by running bash script as a scheduled task in Windows Task Scheduler?
Thanks.
You can either do this yourself with the free BIRT runtime or download the free BIRT iHub F-Type server at http://www.actuate.com/resources/product-downloads/.
How to use the BIRT runtime:
Download the BIRT runtime and install it.
http://download.eclipse.org/birt/downloads/#runtime
Test the runtime installation (if you use Windows it will look like the following)
C:\birt\ReportEngine>echo %BIRT_HOME%
C:\birt
C:\birt\ReportEngine>genReport.bat
C:\birt\ReportEngine>ECHO off
Help for ReportRunner
--mode/-m [run|render|runrender] [options] [rptdesign|rptdocument]
The default mode is runrender.
To see options for run mode, use:
--help/-h run
To see options for render mode, use:
--help/-h render
To see options for runrender mode, use:
--help/-h runrender
Print current message, use --help/-h
Test the runtime in console with a job like
C:\birt\ReportEngine>genReport.bat -o test.pdf -f PDF new_report.rptdesign
Create a batch file for your job (the sample you ran earlier).
In Windows Task Scheduler, make a task to run the batch file for your job.
Run your task on demand to make sure it runs correctly.
Windows task scheduler does have a simple email function but you will probably have to find a better program to send the generated file as email. Then add the script to run this program to your batch file. Make sure you read up on how to configure a task for Windows task scheduler correctly.
It sounds like you need a way of
running the a BIRT report, through the BIRT reporting engine,
using scheduler to control execution of the report a on a particular schedule
specifying output format
and specifying how the output should be delivered in the scheduled job.
You could role your own or you could use a Reporting/BI server that already has all of those capabilities. Depending on your other needs, this may be overkill or exactly right. I am using SpagoBI for that exact purpose. SpagoBI supports BIRT as one of the reporting formats and engines. It uses the quartz scheduler, and does support emailing a PDF version of a report to a specific email address (or list). You might also look into iHub or other products.
http://www.spagobi.org/
http://birt.actuate.com/products/birt-ihub
In SpagoBI, you would deploy your BIRT report to the SpagoBI server from SpagoBI Studio. Then, in SpagoBI Server you would setup the parameters on the report document and create a schedule for the report. On the schedule, you would specify the parameters (if other than default), a schedule, output format, and how you want the output stored/sent.
I am trying to send an email from windows task scheduler with Action tab. But How can I include the Last run result in this mail. I am not getting any option along with it. There is an option of attaching the files to the mail. So if an one could help me is there any logs files generated by the task scheduler when a task is being run? if so where can I find the log ?
You might have to redirect the result into a log file.And then send that log as an attachment.
For send as email , there is definitely an attach button.