DEV Community

Cover image for Automate testing for your Laravel Application using Travis-CI
Chandresh Singh
Chandresh Singh

Posted on

Automate testing for your Laravel Application using Travis-CI

Automate testing for you Laravel application using Travis CI. As an example I will be using a repository containing test case for an API https://github.com/csinghdev/laravel-examples.

If you would like to watch me doing it then you can watch the tutorial here:

Let’s start.

First thing we need to do is create an account on Travis-CI.

If your application is open source then you can use
https://travis-ci.org which is completely free for Open Source Projects.

For private repositories you can use https://travis-ci.com

In this example I will be using https://travis-ci.org.

Create a new account on Travis-CI. It will ask you for access to your GitHub repository for first time.

We have to follow these two steps here:

  1. Activate the repository for which we want to automate testing.
  2. Create a new configuration file .travis.yml inside our repository for Travis-CI.

To activate repository, go to settings and then click on the toggle for that repository.

Settings

Activate

Create a new file .travis.yml Inside your project repository folder

That’s it, Add this file to git, commit your code and push it into the repository.

As soon as we do that, after few seconds, our test cases starts running here for both versions of php.

And after some time as we can see all test cases are done.

You can find the entire code here:

GitHub logo csinghdev / laravel-examples

Laravel Examples. Built on top of https://github.com/csinghdev/laravel-starter

About Laravel-Examples

This application contains examples with screencasts explaining them. It is built on top of Laravel Starter Application but you can follow them for any Laravel App.

Examples included:

  • Create Custom Artisan Command
  • Integration with Travis-CI

Want to do it yourself?

Here is the list of video tutorials you can follow to do it by yourself.

  • Integration with Travis-CI

Integration with Travis-CI

  • Create Custom Artisan Command

Create Custom Artisan Command

Doing it on MacOS?

Here is a simple video to setup Laravel application environment on MacOS using Valet.

Install Valet on Mac

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Hope you find this useful!

Top comments (0)