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
-"Harness_options=j9 test_pod=1 test_ev=1 test_ipv6=1 test_socks=1 Test_tls=1"
-"cpanm-n test::P od test::P od::coverage EV io::socket::ip io::socket::socks Io::socket::ssl"

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://'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'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
-"Cpanm mojo::useragent"
-"Cpanm Test::More"
-"Cpanm devel::cover::report::coveralls"
Perl && 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:// and this will send the cover data to that website.

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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.