Add detailed failed tests information to email sent from jenkins - jenkins

I had successfully configured jenkins build jobs send emails out with basic information in. The content is defined as:
Check console output at $BUILD_URL to view the results.
${FAILED_TESTS}
However, the ${FAILED_TESTS} only return the top-level information, e.g.
1 tests failed. FAILED: XXXMainTest.test Error Message: expected: but was: Stack Trace: java.lang.AssertionError: expected: but was: at test.XXXXTest.test(MainTest.java:27)
If I want to see detailed information thrown from the failed test, I need to click the link and click through each test suite until seeing the test failure information at every end.
Do you have any advice to add detailed tests information to email? Thanks.

I think you will find some help with this plugin:
EMail-ext Plugin
New to version 2.15 is the ability to add attachments using the Ant pattern matching syntax used in many places in Jenkins. You can set a maximum total attachment size in the global configuration page, or it will be unlimited.

Related

How to post detailed test results to slack with fastlane?

I want to post detailed results of my tests to slack using fastlane. When glancing at the tests running from fastlane in my terminal, I notice I have reports such as name of each test, time spent on each test, which ones failed, and with what error. Currently, I have my fastfile set up as described in this doc (at the bottom where it says "Posting Build Results".
https://docs.fastlane.tools/getting-started/ios/running-tests/
However, this only sends number of tests run and number of failures to my slack channel. Is there a way to get a more detailed "report card" of all the tests that ran?
Yes, you can use the Fastlane tool "scan" to get a generalized report of your test cases, it comes up with a HTML page of the test statistics.
https://docs.fastlane.tools/actions/run_tests/
If you want a test coverage report then you should use the other tool "xcov" which will give you coverage report of each file which is included in the test case.
https://docs.fastlane.tools/actions/xcov/

JMeter + Jenkins - How to view Response Data/Assert Failed Results using Performance Plugin in Jenkins

I am integrating JMeter to Jenkins and displaying the result/report using the Performance Plugin and so far it is working fine when the the report shows the Info about if the request is successful or failed, how much time does it take, percentage of error...
I would like to display here more Info if the request is failed, such as Response Data, or in case if it is failed because of an assertion, it should display the message here. Saying in other words, these approaches should act same as View Results Tree Listener in JMeter GUI but I do not know how to attach it to the Performance Plugin in Jenkins.
Does anyone have an idea how to achieve it? Thank you in advanced!
What you can do it add to your plan a View Results Tree and:
fill in file name property.
Click on Configure and check everything except CSV Column Names
Set Errors only
This way, when an error occurs, you'll have all details in this XML file which you can load in JMeter after test to analyze errors.

Unable to generate cucumber reports in jenkins. net.masterthought.cucumber.ValidationException: None report file was added

I am using jenkins to run jobs that uses maven with cucumber . my jobs are running succesfully. I have also managed the plugin Cucumber report in jenkins. But when i view the report i am getting the message as shown in below picture.
I have tried to install various plugins like Jenkins plugin, standalone but with no joy. These are shown as options in the bottom right of the report.
Any clue is helpful. I have tried to check this error in stackover flow also. I didnt get any clue
I could see the reports file in xml which is created by surefire plugin. Any way i can achive reporting part in my project
I managed to get reports in jenkins now.
Previously Jenkins is unable to find the json file in my project.
I have set the path of json file as target and i could able to see the reports.
This might help for those who are looking for answer.
#CucumberOptions(
features= "C:\\Users\\dd pc\\workspace\\PracticeCucumber\\src\\main\\java\\com\\qa\\feature\\Test.feature",
glue= {"com\\qa\\stepDefinition"},
format= {"pretty","html:test-output_1",
"json:target/cucumber-reports/CucumberTestReport.json"},
plugin = ("json:target/cucumber-reports/CucumberTestReport.json"),
monochrome= true,
dryRun= false
)
I am able to solve by providing **/*.json
under Post-build Actions/Cucumber Report/JSON Report Location/ File Include Pattern = **/*.json
First of all in runner file we need to provide following plugin as follows: plugin= {"json:target/cucumber.json" }
Now in Jenkins job, in "post build" section during configuration, add cucumber reports, click on advanced option and provide 'target' text in "JSON Reports Path" text field. Save the job, it will run and will work fine.
Note: target text is the name of folder which we have provided in runner file for generating reports in Json, also cucumber report plugin works on json so need to generate report in json.
I my case the problem was in two jobs over the same test repository (one for Chrome one for Firefox), where one deletes report files after the job while second job was already running and vice versa.

How can I report the test results from a TestNG/Maven/Jenkins tests, via Email and attach screenshot?

I have some SeleniumWebdriver/TestNG/Maven/Java continuous integration tests, that I run in Jenkins.
Every time a test fails, a screenshot of the error is created.
How can I configure Jenkins to send an email to certain people and attach the screenshot upon failure?
The screenshot is located in this directory:
/mnt/www/jenkins/jobs/Integration tests/workspace/target/surefire-reports/
and its name is generated as a combination of a timestamp and the error that has occured, like this:
2013-7-6-12-1-30-UnabletolocateelementmethodlinktextselectorApprove.jpg
Screenshots arent automatically deleted, so there could be quite a few screenshots in that dir.
So, how can I make Jenkins send me the report with the screenshot attached?
OR Can I make TestNG do that? How?
Actually, no need to work with Jenkins, it can be done within the code of the test itself.
Generate the screenshot as described here:
Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?
then install the Java Mail API and a SMTP mailer service on your computer and make your code send email with the screenshot as an attachment upon failure.

Does anyone know a way of getting a list or number of errors before the build process is complete

Our build process deploys our product to a remote instance for testing and sends a custom email to our entire dev team notifying them if it was successful.
Right now I have a custom activity that uses the BuildDetails.CompilationStatus and the BuildDetails.TestStatus to determine if there were any errors in the build process.
Is there anyway to get the specific errors from build process?
The following code actually ended up doing what I wanted and I was able to go through each of the errors and warnings and add them to my email output.
List<IBuildError> builderrors = InformationNodeConverters.GetBuildErrors(buildDetails);
List<IBuildWarning> buildwarnings = InformationNodeConverters.GetBuildWarnings(buildDetails);
You could attach a custom msbuild logger and get all the errors/warnings/messages.
Edit:
Logging in MSBuild
Build loggers

Resources