Travis-ci method of automatic test tool in GitHub

Source: Internet
Author: User
Tags socket

Travis-ci. It's a cloud continuous integration service that runs all the tests in the t/directory under the Perl module directory every time you push the code to perform a functional test of the code. This test will automatically create a virtual machine and can test different versions of Perl. If you pass it will show Green, not through will show red, very convenient.

Configuration of DSL mode

To use this feature, simply add a ". Travis.yml" configuration file to the Perl module on your Github, which automatically monitors the changes in your Github code and automatically submits the test.

Like the usual Perl configuration tests like the following content

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::P od test::P od::coverage EV io::socket::ip io::socket::socks Io::socket::ssl"
-"Cpanm-n--installdeps."
Notifications:
Email:false

First, use the language above to specify the language of your project. Then specify the Perl version you need to test. You can write down what modules you need to install before testing.

Github and Travis CI integration

The above configuration file configuration, put into the directory of your Git project, you need to go through the GitHub account, to Https://travis-ci.org's website to open the test function of your project. After entering, point "Travis CI for Private repositories", the following surface will appear. will be able to see you on the GitHub project, and then choose to open ... Note that you must have the file mentioned above in your project.

After that, each time you submit your code to GitHub, the tool automatically creates a clean virtual machine and then automates the test with the Perl version you specify.

Test process and result queries

You can write notifications to inform you of the test results, and you can also go to https://travis-ci.com/'s website to view detailed test results, as shown below, if red indicates failure, you can see the details of the failure and the process of testing.

Coverage of test code

According to Fayland's guidance ... And found a funny thing. For example, we are in the above ". Travis.yml" configuration file, add the following content

The code is as follows
Before_install:
-"Cpanm mojo::useragent"
-"Cpanm Test::More"
-"Cpanm devel::cover::report::coveralls"
Script
Perl makefile.pl && make test && cover-test-report coveralls

The main part is to join the Cover-test-report coveralls. Because it requires the support of the Devel::cover::report::coveralls module, the above lets first install this.

Then go to the Https://coveralls.io and this will send the cover data to that website.

Then you can add badges to the GitHub page. To show the code coverage

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.