Extracting Test Results from Jenkins Jobs with iOS project
Documents, documents, documents. Documents are the artifacts in large projects to ensure compliance in Software Development Lifecycles (SDLC). One of the mountains of documents required is actually a Unit Tests Report.
Here, I am going to take you on a short 2-minute tour to set up your Jenkin job so it will produce a test results report.
If you have not known how to setup a jenkins job for your project, you could take a look at my previous post here.
Step 1: Install Test Results Analyzer Plugin
We will be using a Jenkins’s plugin call Test Results Analyzer. This gives us 4 kinds of beautiful test results visualisations:
Table
Line
Pie
Bar
Step 2: Integrate plugin with Jenkins job
Go to <Your Project/Job name> -> Configure.
Go to Post-build Actions.
Select Add post-build action -> Publish JUnit test result report.
Enter test-reports/*.xml and ignore the rest of the fields. (including the red message)
Step 3: Run it!
Now, trigger a build to run the job, wait for it to execute all your test cases and now you can retrieve the .xml
file from the root folder. You will also see a new image appearing at your job’s main page.
Tapping on Test Results Analyzer now brings up the visualisations in just a single tap!
Final words
While this may not be the most ideal test results reports we could generate, it however gives us sufficient basic information to provide stakeholders a brief overview of what kind of test cases are executed (assuming we have named our test cases well in TDD & BDD ways).