How to display local test report in Jenkins? - jenkins

My Test suite will generate a XML report and save it in my local machine. Is it possible to read XML report from my local machine and display it in as Jenkins logs.

Your flow seems backwards.
You should run your tests locally BEFORE Jenkins gets involved. Once it looks good locally, use some trigger like a git branch push to have Jenkins also run those tests and create the XML results file on the Jenkins server.
Within the job's configuration you can use a Jenkins plugin for the specific test framework you are using and it will automatically make your test results available within the job's output.
Search for the specific plugin and installation instructions here https://wiki.jenkins.io/display/JENKINS/Plugins

Related

Jenkins pipeline to return results-file after build

I'm running a few tests in my pipeline, results are written to a few .txt files.
Is it possible to upload the .txt files to the jenkins job?
Meaning that the person running the pipeline will receive the results in the browser, and simply download them.
note - junit could have provide a suitable solution, but im not working with XML but with simple txt files
use archiveArtifacts 'myfile.txt'
https://jenkins.io/doc/pipeline/tour/tests-and-artifacts/
Also have a look at the links shared by Dibakar.
If you want to go further, I would recommend to record your test results on another system than jenkins because usually we keep a limited numbers of builds on jenkins. A standard solution is to use sonarqube (there is a Jenkins plugin to help you upload test result on sonar) but you could also upload your results to a database like influxdb (with jenkins influxdb plugin)

How to make JUnit tests access remote server folder when ran thru a jenkins job?

I'm running my Junit tests using a jenkins job, some of the tests require access to a remote server folder in order to create a text file on the folder. How do I configure jenkins job with a remote server for JUnit tests to create a text on the server?
I'm using a maven project which has logic to create a text file on the server. It works all good when I run JUnit tests locally in my IDE because I have access to localhost.
Thanks for reading! will greatly appreciate if someone guides me regarding this.
Make that remote server as a slave node of jenkins, then execute the job that creates folder on the slave, so that it will create the text file on the remove server as you intended.

ghostinspector(phantomjs) running from jenkins and seeing result in jenkins

I am using ghostinspector to record and run tests. I have also seen API integration.
Is there a way I can create a build and when I trigger this build, it runs test on ghostinspector. (I am able to do this using custom build command in jenkins which makes curl request)
In additional to triggering build I would like to see result in jenkins as well. does ghostinspector or phantomjs test script returns result in TAP format or any other format which jenkins can show as test results
Full disclosure: I work for Ghost Inspector.
We now offer the ability to download results from your test suite in XUnit format via our API that you should be able to use in Jenkins to report on your suite status.
Hope that helps.

Deploy war generated on another job

I'm coding some integrations tests, and to run then I would like to first have jenkins running unit tests and quality scan in my code. On this first job the war would be generated.
After generating the war and sending statistics to SonarQube server I want to deploy the artifact generated on the first job to the test environment. I don't want to do this in the first job, because it is possible that the deploy process fails because of the test environment and if that happens the sonar statistics wouldn't be stored.
So I want to deploy the artifact generated in the first job to my tomcat on the test environment and trigger a third job to run the integration tests using the deployed war.
How can I configure jenkins to deploy an artifact generated during a previous job execution?
*I tried shared workspace, but couldn't figure out how to do it, and after a while I discovered it is a bad practice (because of files locked)
Well, I managed to do it using the Copy Artifact Plugin, it allows a job to copy the artifact generated by other job

Jenkins - How to get test results?

I'm trying to create the following scenario:
One instance running Jenkins server. It polls repo and if change occurs it spins up a production instance of my app - let's code name this instance APP_INSTANCE. NOTE: this APP_INSTANCE is NOT a Jenkins slave in any way. It is literally the production server of a web application. No Jenkins stuff installed.
Jenkins passes some configs to APP_INSTANCE like BRANCH_NAME.
APP_INSTANCE checks out BRANCH_NAME and runs test suites.
Jenkins polls APP_INSTANCE via ssh to see when test report file is done being generated.
If Jenkins finds test report file, it assumes tests are done and it copies test report file.
This last part is the part I'm stuck on, how to make Jenkins:
1. copy a file from APP_INSTANCE
2. parse it for test results so it can display them in its web interface. (I assume the test report format has to be jUnit or some sht, right?)
So am I dumb for trying to build this?
P.S. I'm using AWS and this is all happening in the cloud.
Try this plugin.
https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs
And read this:
Setup Jenkins to monitor external job

Resources