39
 継続的テストランナー MakeGood 入門 2011/11/12 関西オープンソース 2011 Piece Project 久保敦啓 (KUBO Atsuhiro)

Introduction to Continuous Test Runner MakeGood

Embed Size (px)

Citation preview

Page 1: Introduction to Continuous Test Runner MakeGood

  

継続的テストランナーMakeGood 入門

2011/11/12 関西オープンソース 2011

Piece Project久保敦啓 (KUBO Atsuhiro)

Page 2: Introduction to Continuous Test Runner MakeGood

  

久保敦啓 (KUBO Atsuhiro) Piece Project プロジェクトリード 株式会社アイテマン 代表取締役 Twitter @iteman メンタリング トレーニング ソフトウェア開発

Page 3: Introduction to Continuous Test Runner MakeGood

  

Piece Framework by Piece Project PHP フレームワーク、ツール オープンソースソフトウェア Piece Project

開発者募集中 スポンサー募集中

Page 4: Introduction to Continuous Test Runner MakeGood

  

Piece Framework by Piece Project Twitter @piece_framework ソースコード

https://github.com/piece 課題管理

http://redmine.piece-framework.com/ Web サイト

http://piece-framework.com/

Page 5: Introduction to Continuous Test Runner MakeGood

  

アジェンダ テスト? テストの自動化 継続的テスト MakeGood

Page 6: Introduction to Continuous Test Runner MakeGood

  

test By DaveBleasdalehttp://www.flickr.com/photos/sidelong/246816211

テスト?

Page 7: Introduction to Continuous Test Runner MakeGood

  

さまざまなテストの分類方法 テストレベル

単体テスト、結合テスト、システムテスト、受け入れテスト

テストタイプ機能テスト、非機能テスト、構造テスト、回帰テスト

テスト設計技法構造ベース、仕様ベース、経験ベース

Page 8: Introduction to Continuous Test Runner MakeGood

  

Questions By Oberazzihttp://www.flickr.com/photos/oberazzi/318947873

Page 9: Introduction to Continuous Test Runner MakeGood

  

誰が何のために?

Page 10: Introduction to Continuous Test Runner MakeGood

  

3 種類のテスト

Page 11: Introduction to Continuous Test Runner MakeGood

  

Developer Testing 誰が?

開発者が 何のために?

開発促進のために

Page 12: Introduction to Continuous Test Runner MakeGood

  

QA Testing 誰が?

品質保証担当者が 何のために?

品質保証のために QA = Quality Assurance

Page 13: Introduction to Continuous Test Runner MakeGood

  

Customer Testing 誰が?

顧客が 何のために?

進捗管理のために

Page 14: Introduction to Continuous Test Runner MakeGood

  

開発プロセス・方法論 テスト駆動開発 (TDD)

Test-Driven Development 受け入れテスト駆動開発 (ATDD) 検証指向 TDD

ビヘイビア駆動開発 (BDD)

Behavior-Driven Development

Page 15: Introduction to Continuous Test Runner MakeGood

  

テスト駆動開発

Page 16: Introduction to Continuous Test Runner MakeGood

  

3 種類のテストと開発手法

Page 17: Introduction to Continuous Test Runner MakeGood

  

テストの実行

Page 18: Introduction to Continuous Test Runner MakeGood

  

テストの実行プロセス1.テストを実行する。

2.期待する結果と実際の結果を比較する。

3.結果をリポートする。

Page 19: Introduction to Continuous Test Runner MakeGood

  

手作業で?

Galley Slaves By ChibiJoshhttp://www.flickr.com/photos/chibijosh/17867308

Page 20: Introduction to Continuous Test Runner MakeGood

  

Escalators By HKmPUAhttp://www.flickr.com/photos/hleung/1295585574

テストの自動化

Page 21: Introduction to Continuous Test Runner MakeGood

  

テスティングフレームワーク PHPUnit Behat PHPSpec …

Page 22: Introduction to Continuous Test Runner MakeGood

  

PHPUnitclass StackTest extends PHPUnit_Framework_TestCase{ public function testPushAndPop() { $stack = array(); $this->assertEquals(0, count($stack)); array_push($stack, 'foo'); $this->assertEquals('foo', $stack[count($stack)-1]); $this->assertEquals(1, count($stack)); $this->assertEquals('foo', array_pop($stack)); $this->assertEquals(0, count($stack)); }

Page 23: Introduction to Continuous Test Runner MakeGood

  

BehatFeature: ls In order to see the directory structure As a UNIX user I need to be able to list the current directory's contents

Scenario: Given I am in a directory "test" And I have a file named "foo" And I have a file named "bar" When I run "ls" Then I should get: """ bar foo """

Page 24: Introduction to Continuous Test Runner MakeGood

  

PHPSpecclass DescribeNewBowlingGame extends \PHPSpec\Context{ private $_bowling = null; public function before() { $this->_bowling = $this->spec(new Bowling); } public function itShouldScore0ForGutterGame() { for ($i=1; $i<=20; $i++) { // someone is really bad at bowling! $this->_bowling->hit(0); } $this->_bowling->score->should->equal(0); }

Page 25: Introduction to Continuous Test Runner MakeGood

  

3 種類のテストとフレームワーク

Page 26: Introduction to Continuous Test Runner MakeGood

  

さらなる自動化

Page 27: Introduction to Continuous Test Runner MakeGood

  

継続的インテグレーションContinuous Integration

http://jenkins-ci.org/

Page 28: Introduction to Continuous Test Runner MakeGood

  

継続的テストContinuous Testing

Day 61 - Watering tulips By Mournehttp://www.flickr.com/photos/mourner/3552724584

Page 29: Introduction to Continuous Test Runner MakeGood

  

継続的テストツール MakeGood

http://redmine.piece-framework.com/projects/makegood

Stagehand_TestRunnerhttp://redmine.piece-framework.com/projects/stagehand-testrunner

Page 30: Introduction to Continuous Test Runner MakeGood

  

Stagehand_TestRunner

Page 31: Introduction to Continuous Test Runner MakeGood

  

インストール$ pear channel-discover pear.piece-framework.com$ pear install piece/stagehand_testrunner

Page 32: Introduction to Continuous Test Runner MakeGood

  

テストの作成FooTest.php:

<?phpclass FooTest extends PHPUnit_Framework_TestCase{ /** * @test */ public function alwaysTrue() { $expected = $actual = true; $this->assertEquals($expected, $actual); }}

Page 33: Introduction to Continuous Test Runner MakeGood

  

テストの実行$ phpunitrunner FooTest.php PHPUnit 3.5.15 by Sebastian Bergmann.

.

Foo [x] Always true

Time: 0 seconds, Memory: 6.75Mb

OK (1 test, 1 assertion)

Page 34: Introduction to Continuous Test Runner MakeGood

  

テストの実行 (PHPUnit)$ phpunit FooTest.php PHPUnit 3.5.15 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 6.00Mb

OK (1 test, 1 assertion)

Page 35: Introduction to Continuous Test Runner MakeGood

  

継続的テスト$ phpunitrunner -a .( ファイルの追加・削除・変更でテストが実行される。 )$ phpunitrunner -an .(Growl/notify-send で結果が通知される。 )

Page 36: Introduction to Continuous Test Runner MakeGood

  

MakeGood

Page 37: Introduction to Continuous Test Runner MakeGood

  

MakeGood UniverseA continuous testing platform

2012 年 1 月リリース予定

Page 38: Introduction to Continuous Test Runner MakeGood

  

和田卓人「[動画で解説]和田卓人の“テスト駆動開発”講座:第 3 回 「テスト」という言葉について ── Developer Testing , Customer Testing , QA Testing 」

http://gihyo.jp/dev/serial/01/tdd/0003, 2007 年。

川西俊之「 DevLOVE LT: Do you know axes of software testing? 」

http://www.slideshare.net/tosikawa/ss-1632677, 2009 年。

大田健一郎「テストエンジニアと TDD 」『ソフトウェア・テスト PRESS 総集編』、技術評論社、 2011 年。

参考

Page 39: Introduction to Continuous Test Runner MakeGood

  

Sebastian Bergmann 「 PHPUnit Manual 」

http://www.phpunit.de/manual/3.5/ja/index.html

Konstantin Kudryashov 「 Behat Documentation 」

http://docs.behat.org/index.html

Pádraic Brady, The PHPSpec Development Team 「 Reference Manual 」

http://www.phpspec.net/documentation/

参考