Jenkins - How to get test results? - jenkins

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

Related

How to display local test report in 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

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.

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

When selenium test runs by Jenkins and nUnit, the browser doesn't come up however there are valid results

I would say that my problem rather lack of information and I need some confirmation than a real problem. It seems somebody else had similar question question.
I put together a machine (Windows Server 2012R2) for POC reasons where a Jenkins installed and it executes Selenium UI tests using nunit. The nunit tests are generated by Specflow.
I could do:
install jenkins
jenkins run by a valid user not by Service account
set up jenkins properly
it can pull the source code from TFS-GIT
it can compile the C# solution
it can execute the test project
the test results are correct
Selenium plugin installed on Jenkins but I don't think it is used in this case because the text execution is about executing nunit and it deals with everything else.
At the moment I don't need the capability to delegate test execution to other Jenkins slaves or machines because the Jenkins does have only one compile task. Compiling, executing and test running can go parallel, the machine able to deal with it.
But, when I log in the server where the Jenkins runs and I watch what happens during CI build (compile and test execution) I can't see that the browser (Firefox) starts, however, the test results and the logs show that a browser was executed.
What I did so far:
jenkins runs as service, the account is an existing account
If I remote to the machine with the account which is set up for the service, then I can't see the browser will be executed, however, the log shows that something had happened.
My question is that, what the hack is happening when my tests are executed by Jenkins? If I execute the command which is used by Jenkins from console on the same machine then I can see that Firefox starts, does what is programmed in the tests and the results are in the result.xml. Can I accept the result as valid result? Can I somehow set up Jenkins the way the browser really executed (I can believe it when I see it :) )?
I think this is because you run Jenkins as a service. Services do not show up in desktop. Workaround is to run Jenkins or slave from CMD.
Jenkins windows slave service does not interact with desktop

Giving jenkins access to third party logs

I have a jenkins job that executes a batch file that runs some tests on a Jenkins slave.
The tests are designed to store their output in an html file on the Jenkins slave.
If I look at the output in Jenkins, it is quite limited since the test data is in the .html file on the slave. How can I then get Jenkins to read this data so that you don't need to log into the slave to review the test logs?

Resources