Open Event Web app uses Travis CI as a platform to perform unit testing. Travis CI is a hosted, distributed continuous integration service used to build and test projects hosted at GitHub. Travis CI automatically detects when a commit has been made and pushed to a GitHub repository that is using Travis CI, and each time this happens, it will try to build the project and run tests. Travis build took around 24 minutes to complete when any commit is made to the project, which is a very large time, to reduce the build time we parallelized the build which uses maximum amount of resources available at that time and run the builds parallely which resulted into better use of resources as well as required lesser amount of time.
Open Event web app uses saucelabs integration to perform selenium tests and travis to perform continuous integration.
Why parallelize the build?
When there are unit tests that are independent of each other and can be executed using a common set of dependencies, those procedures can be performed parallely on different virtual machines bringing out maximum throughput.
Running say a large number of tests on a single machine can increase the build time to a large extent, this build time can be reduced significantly by running the tests parallely on different machines. Open Event Webapp has a build time of around 24 minutes which is reduced to half on parallelising the build.
Parallelizing your builds across virtual machines
To speed up a test suite, you can break it up into several parts using Travis CI’s build matrix feature.
Say you want to split up your unit tests and your integration tests into two different build jobs. They’ll run in parallel and fully utilize the available build capacity and the resources.
The architecture of open event webapp supports test suite for all the pages in the generated application. To parallelize the build, the test suite is divided in different files with the directory structure as shown below:
The env key in travis.yml is modified as shown below:
The script running tests fetches environment variable and runs the test file accordingly as shown below:
The build time which was earlier 23 minutes is reduced to 12 minutes after parallelizing the build.
- Open Event Webapp Repository: https://github.com/fossasia/open-event-webapp
- Pull Request: https://github.com/fossasia/open-event-webapp/pull/1858
- Issue : https://github.com/fossasia/open-event-webapp/issues/1601
- Speeding up the build – Travis CI: https://docs.travis-ci.com/user/speeding-up-the-build/