Today I will be talking about Coveralls and Travis integration into Loklak APIs.
Wikipedia defines it as:
Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub.
Travis takes care of the tests and deployment of apps. Travis integration is really easy when you have your tests ready. It was a basic three step process:
- Registering the API repos with Travis.
.travis.ymlto the API github repository. e.g. For
loklak_php_api, the file looks like this.
phpversions are specified for which the API is to be tested. We added
scriptsince we wanted Travis to execute the tests.
- Trigger the first build with a
And the first build is up.
Coveralls is a presentation of the coverage of test suite you pass to Travis to build. In layman language, Coveralls helps you find the lines in your code which were not tested by your Test Suite.
Coveralls integration is also simple, but might involve some googling if you are working on PHP. I will take the example of
- Registering the API repo with Coveralls.
- Modifying the
- Creating a
.coveralls.ymlfile to specify the paths required to send the coverage to Coveralls
- Since testing of only
loklak.phpwas required, so a
phpunit.xmlfile was added to exclude
Requestsdirectories from test suite.
After configuring the environment, there we have it. Coveralls result showing the code coverage of our test suite on loklak.php!