TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit
-
Upload
angel-sullon -
Category
Documents
-
view
167 -
download
0
description
Transcript of TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit
![Page 2: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/2.jpg)
Agenda
• Instalar PHPUnit (Manualmente)• Probando PHPUnit Con NetBeans 7.0.1
![Page 3: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/3.jpg)
Configuración General
![Page 4: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/4.jpg)
Instalacion de Xampp• Instalar “xampp-win32-1.7.4-VC6-installer.exe” dentro de la carpeta Server
![Page 5: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/5.jpg)
D:\Development\Server\Xampp\apache\conf\httpd.conf
#Listen [::]:80Listen 1009
![Page 6: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/6.jpg)
D:\Development\Server\Xampp\apache\conf\extra\httpd-ssl.conf
#Listen [::]:443Listen 543
![Page 7: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/7.jpg)
Instalar PHPUnit (Manualmente)
Descargar http://pear.phpunit.de/get/PHPUnit-
3.5.15.tgz
![Page 8: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/8.jpg)
Eliminar PHPUnit y PHPUnit2, Pegar PHPUnit-3.5.15.tgz. descomprimir
![Page 9: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/9.jpg)
Cortar PHPUnit y pegar en D:\Development\Server\Xampp\php\PEAR
![Page 10: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/10.jpg)
Quitar la extensión de phpunit.php. Luego cortar junto a phpunit.bat
![Page 11: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/11.jpg)
Pegar en D:\Development\Server\Xampp\php y reemplazar ambos archivos
![Page 12: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/12.jpg)
phpunit
#!/usr/bin/env php
Cambiar por
#!\xampp\php\.\php.exe
![Page 13: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/13.jpg)
phpunit
if (strpos('@php_bin@', '@php_bin') === 0) { set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
get_include_path());}Cambiar por if (strpos('D:\Development\Server\Xampp\php', 'D:\Development\Server\Xampp\php') === 0) { set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());}
![Page 14: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/14.jpg)
phpunit.batif "%PHPBIN%" == "" set PHPBIN=@php_bin@if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATHGOTO RUN:USE_PEAR_PATHset PHPBIN=%PHP_PEAR_PHP_BIN%:RUN"%PHPBIN%" "@bin_dir@\phpunit" %*
Cambiar por
"D:\Development\Server\Xampp\php\.\php.exe" "D:\Development\Server\Xampp\php\.\phpunit" %*
![Page 15: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/15.jpg)
D:\Development\Server\Xampp\php\php.ini
[XDebug]zend_extension = "D:\Development\Server\Xampp\php\ext\php_xdebug.dll“
xdebug.collect_includes = 1
![Page 16: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/16.jpg)
Comprobando pear installed
![Page 17: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/17.jpg)
Phpunit falta PEAR PHP
![Page 18: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/18.jpg)
Desargar archivos PEAR PHP. Estos archivos pueden desargarse del plugin para eclipse
http://www.phpsrc.org/eclipse/pti/
Ó de http://www.assembla.com/code/pti/subversion/nodes/libraries/pear/PEAR/PHP?rev=764
![Page 19: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/19.jpg)
Phpunit falta PEAR File
![Page 20: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/20.jpg)
Desargar archivos PEAR PHP. Estos archivos pueden desargarse del plugin para eclipse
http://www.phpsrc.org/eclipse/pti/
Ó de http://www.assembla.com/code/pti/subversion/nodes/libraries/pear/PEAR/PHP?rev=764
![Page 21: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/21.jpg)
Comprobando phpunit installed
![Page 22: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/22.jpg)
Probando PHPUnit Con NetBeans 7.0.1
![Page 23: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/23.jpg)
PhpUnitario1 Project
![Page 24: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/24.jpg)
Ir a Tools>Option>PHP
![Page 25: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/25.jpg)
Add PHP Class y Generar Test
![Page 26: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/26.jpg)
![Page 27: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/27.jpg)
![Page 28: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/28.jpg)
Desargar archivos PEAR Text. Estos archivos pueden desargarse del plugin para eclipse
http://www.phpsrc.org/eclipse/pti/
Ó de http://www.assembla.com/code/pti/subversion/nodes/libraries/pear/PEAR/PHP?rev=764
![Page 29: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/29.jpg)
SumaTest generate
![Page 30: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/30.jpg)
Run test
![Page 31: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/31.jpg)
Coverage Report
![Page 32: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/32.jpg)
Clic Report button
![Page 33: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/33.jpg)
Report Coverage
![Page 34: TDD: Desarrollo dirigido por pruebas con PHP, PHPUnit 3.5.15/ JSP, JEE, JUnit](https://reader035.fdocuments.es/reader035/viewer/2022081414/54f592c84a7959e9378b4bc3/html5/thumbnails/34.jpg)
100% tested coverage