Coveralls and Travis support for Loklak APIs

Today I will be talking about Coveralls and Travis integration into Loklak APIs.

Travis CI

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:

  1. Registering the API repos with Travis.
    Selection_047
  2. Adding .travis.yml to the API github repository. e.g. For loklak_php_api , the file looks like this.
    Selection_048
    language and php versions are specified for which the API is to be tested.  We added phpunit Tests in script since we wanted Travis to execute the tests.
  3. Trigger the first build with a git push

And the first build is up.

Selection_049

Coveralls

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 loklak_php_api here.

  1. Registering the API repo with Coveralls.
    Selection_051
  2. Modifying the .travis.yml to this
    Selection_052
  3. Creating a .coveralls.yml file to specify the paths required to send the coverage to Coveralls
    Selection_053
  4. Since testing of only loklak.php was required, so a phpunit.xml file was added to exclude Tests and Requests directories from test suite.
    Selection_054

After configuring the environment, there we have it. Coveralls result showing the code coverage of our test suite on loklak.php!
Selection_050

Coveralls and Travis support for Loklak APIs