Page MenuHomec4science

Unit Tests
Updated 1,962 Days AgoPublic

How to do Continuous Integration (CI)

There are two ways of doing unit testing in c4science

Using Jenkins on c4science

Access

Jenkins on c4science is in private beta mode. You can ask to have access. Once you're given access to the group #jenkins_access
you will see a Jenkins Job tab on every of your repository and a Create Jenkins Jobon your Project.

How this works

You can create a new Job from a Project page or from the Jenkins application. You'll have to provide a Project that will be used as Policy for the job. Only the people in the Project will have access to the Job on Jenkins. You also have to provide a branch the Job will use.

Once you created the job, a Harbormaster build plan and a Herald commit rule will automatically be created. The Herald rule triggers the Harbormaster build plan on new commit on the Repository/Branch couple. The build plan then call the new Jenkins Job.

You can see the status of the job from the Project page and the Repository page, as well as the link to the Jenkins job.

Jenkinsfile

The most important part of the setup is the Jenkinsfile. It is a file that must be present in your repository/branch the job will execute against. This file contains a set of options and command that define your Job.

Examples
  • You can find basic example in this repo: rPHJENKINS and discuss about the experience in the chatroom

Using Arcanist on your local machine

We'll be using a community extensions to integrate your custom unit test engine with Phabricator. This extensions allows any TAP compatible engine to be used. You can also write your own engine, take a look at the documentation.

  • In your repository
  • Add the lib as a submodule
git submodule add https://github.com/tagview/arcanist-extensions.git .arcanist-extensions
git submodule update --init
  • Create an .arcconfig file with the following content
{
  "load": [
    ".arcanist-extensions/tap_test_engine"
  ],

  "unit.engine": "TAPTestEngine",
  "unit.engine.tap.command": "your_unit_test_script.sh"
}
  • Replace your_unit_test_script.sh by a script in your repository that do the unit testing and returns the result in a TAP format
  • For instance if your code is in python, you can use tap.py, see the example in rPHTEST
  • Those tests can be run by using the arc unit command or it will be run automatically when you create a Differential Revision using Arcanist (arc diff)
Last Author
aubort
Last Edited
Dec 4 2018, 11:31

Event Timeline

admin moved this document from Restricted Phriction Wiki DocumentFeb 20 2016, 13:45
admin edited the content of this document. (Show Details)Mar 8 2016, 13:19
admin changed the title from Unit Tests with arcanist to Unit Tests and Lint.Mar 8 2016, 14:53
admin edited the content of this document. (Show Details)Mar 11 2016, 12:50
admin changed the title from Unit Tests and Lint to Unit Tests.
admin edited the content of this document. (Show Details)
admin edited the content of this document. (Show Details)
admin edited the content of this document. (Show Details)Mar 11 2016, 16:55
admin edited the content of this document. (Show Details)Mar 11 2016, 17:10
admin edited the content of this document. (Show Details)Mar 11 2016, 17:12
admin edited the content of this document. (Show Details)Mar 12 2016, 00:41
aubort edited the content of this document. (Show Details)Apr 7 2016, 17:31
aubort edited the content of this document. (Show Details)Apr 8 2016, 09:42
aubort edited the content of this document. (Show Details)Apr 8 2016, 10:05
aubort edited the content of this document. (Show Details)Jun 2 2016, 16:39
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)Jun 3 2016, 16:36
aubort added a subscriber: jenkins.
aubort changed the visibility from "All Users" to "Public (No Login Required)".Jun 7 2016, 12:46
aubort edited the content of this document. (Show Details)Sep 2 2016, 10:10
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)Oct 7 2016, 15:45
aubort edited the content of this document. (Show Details)Oct 7 2016, 15:53
aubort edited the content of this document. (Show Details)Oct 9 2016, 16:54
aubort edited the content of this document. (Show Details)Oct 9 2016, 17:57
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)Oct 13 2016, 15:36
aubort changed the edit policy from "c4science (Project)" to "Restricted Project (Project)".Dec 16 2016, 16:50
aubort edited the content of this document. (Show Details)Dec 21 2016, 11:59
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)Dec 21 2016, 12:01
aubort edited the content of this document. (Show Details)Mar 13 2017, 15:25
aubort added a project: c4science.
aubort removed a subscriber: jenkins.
aubort edited the content of this document. (Show Details)Nov 8 2017, 11:18
aubort added a subscriber: jenkins.
aubort edited the content of this document. (Show Details)Apr 3 2018, 12:52
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)
aubort removed a subscriber: jenkins.
aubort edited the content of this document. (Show Details)Oct 31 2018, 16:41
aubort edited the content of this document. (Show Details)Dec 4 2018, 11:29
aubort edited the content of this document. (Show Details)