Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Text
クックビズ勉強会
(TDD)—>Test Driven Development
> CodeCeption
CodeCeption
Test Framework
Acceptance Tests
Functional Tests
Unit Tests
一番簡単
Powered by PHPUnit -> standard
Yii2 modules
S...
例
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('create wiki page');
$I->amOnPage('/');
$I->click('Pages');
$I->c...
Different tests type
Acceptance
Tests
Functional
Tests
Unit Tests
Yii2 BackendFrontend
Browser
Selenium
PhantomJS
HTML
HTM...
Acceptance Tests
Enable to do request and interact with the DOM
Use a fake browser to perform the queries
Can click and fil...
Functional Tests
Same as Acceptance test but does not use a browser
engine
Can be plugged with the framework to access int...
Unit Tests
Used to test functions
Difficult to use in MVC
Can be plugged with the framework to access internal functions an...
インストール
Mac OSX:
brew update && brew install codeception
Linux:
wget http://codeception.com/codecept.phar .
php codecept.ph...
Getting ready
BootStrap
>codecept bootstrap
>codecept generate:cept acceptance Validation
Edit the configuration file : test...
Let’s get the party started
>codecept run
>codecept run —debug
Bonus
>codecept generate:scenarios acceptance //English ver...
References
Installation : http://codeception.com/install
Acceptance Tests : http://codeception.com/docs/04-
AcceptanceTest...
Code retreat Codeception
Próxima SlideShare
Cargando en…5
×

Code retreat Codeception

445 visualizaciones

Publicado el

Presentation of Codeception in Japanese and English

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Code retreat Codeception

  1. 1. Text クックビズ勉強会 (TDD)—>Test Driven Development > CodeCeption
  2. 2. CodeCeption Test Framework Acceptance Tests Functional Tests Unit Tests 一番簡単 Powered by PHPUnit -> standard Yii2 modules Selenium2 やPhantomJSと使える
  3. 3. 例 <?php $I = new AcceptanceTester($scenario); $I->wantTo('create wiki page'); $I->amOnPage('/'); $I->click('Pages'); $I->click('New'); $I->see('New Page'); $I->fillField('title', 'Hobbit'); $I->fillField('body', 'By Peter Jackson'); $I->click('Save'); $I->see('page created'); // notice generated $I->see('Hobbit','h1'); // head of page of is our title $I->seeInCurrentUrl('pages/hobbit'); $I->seeInDatabase('pages', array('title' => ‘Hobbit')); ?>
  4. 4. Different tests type Acceptance Tests Functional Tests Unit Tests Yii2 BackendFrontend Browser Selenium PhantomJS HTML HTML $_GET,$_POST, $_REQUEST Yii2 Module Backend User Scenario Developer Scenario Function Testing
  5. 5. Acceptance Tests Enable to do request and interact with the DOM Use a fake browser to perform the queries Can click and fill forms Can be plugged with Selenium/PhantomJS to interact with JavaScript and screenshots
  6. 6. Functional Tests Same as Acceptance test but does not use a browser engine Can be plugged with the framework to access internal functions and properties (Models, validation) Use $_REQUEST, $_POST and $_GET Faster but less interaction
  7. 7. Unit Tests Used to test functions Difficult to use in MVC Can be plugged with the framework to access internal functions and properties (Models, Validation) public function testValidation() { $user = User::create(); $user->username = null; $this->assertFalse($user->validate(['username'])); $user->username = 'toolooooongnaaaaaaameeee'; $this->assertFalse($user->validate(['username'])); $user->username = 'davert'; $this->assertTrue($user->validate(['username'])); }
  8. 8. インストール Mac OSX: brew update && brew install codeception Linux: wget http://codeception.com/codecept.phar . php codecept.phar bootstrap Windows: php composer.phar global require “codeception/codeception:*” Composer/ PhpStorm: php composer.phar require “codeception/codeception:*”
  9. 9. Getting ready BootStrap >codecept bootstrap >codecept generate:cept acceptance Validation Edit the configuration file : tests/acceptance.suite.yml class_name: AcceptanceTester modules: enabled: - PhpBrowser - AcceptanceHelper config: PhpBrowser: url: 'https://foogent.jp/'
  10. 10. Let’s get the party started >codecept run >codecept run —debug Bonus >codecept generate:scenarios acceptance //English version >codecept console acceptance //Interactive console >codecept run —debug —env test
  11. 11. References Installation : http://codeception.com/install Acceptance Tests : http://codeception.com/docs/04- AcceptanceTests Yii2 module : http://codeception.com/docs/modules/Yii2 WebDriver : http://codeception.com/docs/modules/ WebDriver Yii2 Database Faker : http://qiita.com/tanakahisateru/items/ c4d39cc77a71067ed658

×