31
Continuous Integration - The first step of Auto Testing- 2016/07/07 Mulodo Vietnam Co., Ltd.

CI : the first_step: Auto Testing with CircleCI - (MOSG)

Embed Size (px)

Citation preview

Page 1: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Continuous Integration - The first step of Auto Testing-

2016/07/07 Mulodo Vietnam Co., Ltd.

Page 2: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Continuous IntegrationIn software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.

Grady Booch first named and proposed CI in his 1991 method,[1] although he did not advocate integrating several times a day.

Extreme programming (XP) adopted the concept of CI and did advocate integrating more than once per day - perhaps as many as tens of times per day.

wikipedia

Page 3: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Almost development works are

‘Enhancement of current system’.

Why CI?

* Rapid cycle : ‘Plan(Enlarge) - Dev - Measure(Enlarge)’

* Tests : not only for new code, but also ALL. (to avoid regression)

Page 4: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Almost development works are

‘Enhancement of current system’.

Why CI?

* Rapid cycle : ‘Plan(Enlarge) - Dev - Measure(Enlarge)’

* Tests : not only for new code, but also ALL. (to avoid regression)

Tests are increasing || Dev cycle is going faster

Page 5: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Almost development works are

‘Enhancement of current system’.

Why CI?

* Rapid cycle : ‘Plan(Enlarge) - Dev - Measure(Enlarge)’

* Tests : not only for new code, but also ALL. (to avoid regression)

Tests are increasing || Dev cycle is going faster

No way out

Page 6: CI : the first_step: Auto Testing with CircleCI - (MOSG)

dev cycle (engineer side)

https://www.apicasystem.com/blog/top-5-tips-avoid-integration-hell-continuous-integration/

Page 7: CI : the first_step: Auto Testing with CircleCI - (MOSG)

PLAN CODE BUILD TEST RELEASE DEPLOY

legacy Engineering

dev cycle (engineer side)

Page 8: CI : the first_step: Auto Testing with CircleCI - (MOSG)

PLAN CODE BUILD TEST RELEASE DEPLOY

Continuous Integration

Continuous Delivery

legacy Engineering

dev cycle (engineer side)

Page 9: CI : the first_step: Auto Testing with CircleCI - (MOSG)

PLAN CODE BUILD TEST RELEASE DEPLOY

Continuous Integration

Continuous Delivery

legacy Engineering

dev cycle (engineer side)

Use Technology to solve the problem.

Auto-Testing

Auto-Deploy

Page 10: CI : the first_step: Auto Testing with CircleCI - (MOSG)

dev cycle (from client side)

Huh? Tests? That’s not my business.

Please ask testers.

No problem. We are testing our code in

standard dev-flow

Page 11: CI : the first_step: Auto Testing with CircleCI - (MOSG)

dev cycle (from client side)

Huh? Tests? That’s not my business.

Please ask testers.

No problem. We are testing our code in

standard dev-flow

Which engineer do you think better?

Page 12: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Aut0-Testing (auto-deploy)

So, “Testing” become a much important thing than you think.

Let’s start Auto-testing

Page 13: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Tools

CI tools

Test tools

https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks

Page 14: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Tools

CI tools

Test tools

https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks

Page 15: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Today’s GOAL

1. push code to github 2. (AUTO) Testing on Circle CI 3. (AUTO) E-mail reporting

very simple

Page 16: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Flow

That’s ALL

create repository on github.com

create sample code and unit test code

register to CircleCI

Page 17: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Flow

create repository on github.com

create sample code and unit test code

register to CircleCI

That’s ALL

You can try auto-testing very easy !

Page 18: CI : the first_step: Auto Testing with CircleCI - (MOSG)

sample [email protected]:nemo-mulodo-vn/test_circleci.git

calc.php-------------------sampleclassphpunit.xml-----------------phpunitsettingtests/bootstrap.php----------phpunittestrunnnertests/calcTest.php----------phpunittestcode

composer.json--------------composersetting

Page 19: CI : the first_step: Auto Testing with CircleCI - (MOSG)

sample code

$ git clone [email protected]:nemo-mulodo-vn/test_circleci.git Cloning into 'test_circleci'... remote: Counting objects: 20, done. remote: Compressing objects: 100% (14/14), done. remote: Total 20 (delta 1), reused 17 (delta 1), pack-reused 0 Receiving objects: 100% (20/20), done. Resolving deltas: 100% (1/1), done. Checking connectivity... done. $ cd test_circleci $ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files $

preparation - git clone - install required modules w/ composer

Page 20: CI : the first_step: Auto Testing with CircleCI - (MOSG)

sample code

$ ./vendor/bin/phpunit PHPUnit 4.8.26 by Sebastian Bergmann and contributors.

Runtime: PHP 5.5.30 Configuration: /Users/nemo/git/tmp/test_circleci/phpunit.xml

......

Time: 189 ms, Memory: 4.00MB

OK (6 tests, 6 assertions) $

test at local environment

Page 21: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

1. Open CircleCI

https://circleci.com/

Note) Please open github.com with your account on another tab.

Page 22: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

2. Request authorization to your github

Page 23: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

3. Confirm authorization

Page 24: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

4. Select account (or Organization)

Page 25: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

5. Select repository

Page 26: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

6. Start build and testing !!!!

environment

closing

testing

Page 27: CI : the first_step: Auto Testing with CircleCI - (MOSG)

register repository to CircleCI

6. Start build and testing !!!!

environment

closing

testing<-donoting

This screenshot is on a case without any test code.

NO TEST

Page 28: CI : the first_step: Auto Testing with CircleCI - (MOSG)

That’s ALL

Much easier than I thought

Page 29: CI : the first_step: Auto Testing with CircleCI - (MOSG)

circle.ymlA configuration file for CircleCI

try to specify PHP version on CircleCI.

machine: php: version: 5.6.14

circle.yml

git add, commit, push

Page 30: CI : the first_step: Auto Testing with CircleCI - (MOSG)

circle.ymlSome more example

machine: php: version: 5.6.14

dependencies: override: - composer install --prefer-source --no-interaction --dev

test: override: - echo “Thanks for spending your time"

circle.yml

https://circleci.com/docs/configuration/

You can deploy code to specified EC2 server and test on the server. (if u need)

Page 31: CI : the first_step: Auto Testing with CircleCI - (MOSG)

Thank you

I am happy, If you become

motivated to test.