How to run the automated testing tool travis-ci on Github _ PHP Tutorial

Source: Internet
Author: User
The method for automatically testing the tool travis-ci in Github. The method of the automated testing tool travis-ci in Github: travis-ci. it is a cloud-based continuous integration service. This tool will automatically test the tool's travis-ci method in Github every time you push code for submission.

Travis-ci. it is a cloud-based continuous integration service. this tool tests the code function every time you push the code, to run all tests in the t/directory under the Perl module directory. this test will automatically create a virtual machine and test different Perl versions. if it is passed, green is displayed. if it is not passed, red is displayed, which is very convenient.

DSL configuration

To use this function, you only need to add ". travis. yml configuration file, which can automatically monitor the code changes on your Github, and automatically submit the test.

Common Perl configuration tests are as follows:

The code is as follows:
Language: perl
Perl:
-5.20"
-5.18"
-5.16"
-5.14"
-5.12"
-5.10"
Env:
-"HARNESS_OPTIONS = j9 TEST_POD = 1 TEST_EV = 1 TEST_IPV6 = 1 TEST_SOCKS = 1 TEST_TLS = 1"
Install:
-"Cpanm-n Test: Pod: Coverage ev io: Socket: ip io: Socket: Socks IO: Socket: SSL"
-"Cpanm-n -- installdeps ."
Communications:
Email: false

First, specify the language of your project through the preceding language. then, specify the Perl version you want to test. you can specify the modules you need to install before the test.

Github and Travis CI integration

The above configuration file configuration is complete, put into your git project directory after, you need to through the github account, go to the https://travis-ci.org site to activate your test function of this project. click "Travis CI for private Repositories" to display the following figure. you can see your project on github and choose to open... Note that the files mentioned above must be included in your project.

After this is done, every time you submit code to github, this tool will automatically create a clean virtual machine, and then perform automated testing through the Perl version you specified.

Test process and result query

You can write the notifications to notify you of the test results, and you can also go to the https://travis-ci.com/website to view the detailed test results, as shown below, if it is red, it indicates failure, click red to see the detailed failure cause and test process.

Test code coverage

According to Fayland's instructions... Another interesting thing was found. for example, we added the following content to the configuration file ". travis. yml" above.

The code is as follows:
Before_install:
-"Cpanm Mojo: UserAgent"
-"Cpanm Test: More"
-"Cpanm Devel: Cover: Report: coverils"
Script:
Perl Makefile. PL & make test & cover-test-report coverils

This section includes cover-test-report coverall. because it requires support from the Devel: Cover: Report: coverallmodule, you must first install this section.

Then go to the https://coveralls.io to open, this will cover the data sent to the site.

In this way, you can add badges on the github page to display the code coverage.

Using the travis-ci method, travis-ci. it is a cloud-based continuous integration service. This tool will implement the code function every time you push code to commit...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.