PHPSP TestFest 2009

Rafael Dohms
Rafael DohmsLead Backend Engineer at Usabilla
Slides baseados no trabalho de SebastianBergmann, traduzido por José Ricardo (PHPMS) e adaptado por Silvano Girardi (PHPSC),[object Object],Original: http://sebastian-bergmann.de/talks/,[object Object]
Olá eu sou a TestFest,[object Object],Objetivos,[object Object],Aumentar a abrangência do código do interpretador de PHP (com testes),[object Object],Motivar usuários a participar, (re|con)tribuir com o PHP,[object Object],Unir e motivar membros do grupo de usuário,[object Object],Qualificar o participante com uma nova ferramenta,[object Object],Atividade Global,[object Object],Em 2009: Países de todo mundo já realizaram TestFests,[object Object],PHPSP: Primeiro voluntário do Brasil e Segundo a realizar um testfest,[object Object],Próximas oportunidades,[object Object],PHPBR: TestFest durante o FISL (24 a 27/Junho),[object Object]
Como será nosso dia?,[object Object],Preparação,[object Object],Palestra e apresentação ao PHPT,[object Object],Instalação de VMs para trabalho,[object Object],Configurações,[object Object],Escolha,[object Object],Escolher áreas que iremos focar,[object Object],Dividir em grupos de trabalho,[object Object],MadCodingSkillz Time,[object Object],Escrever testes,[object Object],Testar testes,[object Object],Finalização,[object Object],Verificar impacto (%),[object Object],Commitar testes para repositório SVN do PHP,[object Object]
PHPT,[object Object],Cada arquivo .phpt possui um unico teste,[object Object],Cada teste é executado por um processo separado,[object Object],Isolamento total do teste,[object Object],Configuração do PHP independente para cada teste,[object Object],A suite de testes sobrevive a erros fatais, segfaults, etc..,[object Object],PHPT: http://phpt.info,[object Object]
Dando nome ao seu filho,[object Object],Testes queilustramfalhasreportadas (bugs)‏,[object Object],bug<bugid>.phpt,[object Object],Testes de comportamentobásico de umafunção,[object Object],<functionname>_basic.phpt,[object Object],Testes de comportamentoerrôneo de umafunção,[object Object],<functionname>_error.phpt,[object Object],Testes de variações no comportamento de umafunção,[object Object],<functionname>_variation.phpt,[object Object],Testes variadosparaextensões,[object Object],<extname><no>.phpt,[object Object]
O Teste mais simples do mundo,[object Object],--TEST--,[object Object],Hello World,[object Object],--FILE--,[object Object],Hello World,[object Object],--EXPECT--,[object Object],Hello World,[object Object]
Agora com PHP,[object Object],--TEST--,[object Object],Hello World,[object Object],--FILE--,[object Object],<?php print'Hello World'; ?>,[object Object],--EXPECT--,[object Object],Hello World,[object Object]
Expectativas,[object Object],--TEST--,[object Object],Hello World,[object Object],--FILE--,[object Object],<?php print'Hello World,[object Object],--EXPECTF--,[object Object],Parse error: syntax error, unexpected $end in %s.php on line %d,[object Object],[object Object]
%d - numero
%c - um character
%w - espaço
%i - inteiro
%f - real
%x - hexadecimal
%e – separador de diretórios,[object Object]
Limpando a sujeira,[object Object],--TEST--,[object Object],Removendoarquivostemporários,[object Object],--FILE--,[object Object],<?php,[object Object],$temp_filename = dirname(__FILE__) . '/foo.tmp';,[object Object],$fp = fopen($temp_filename, 'w');,[object Object],fwrite($fp, 'bar');,[object Object],fclose($fp);,[object Object],?>,[object Object],--CLEAN--,[object Object],<?php,[object Object],$temp_filename = dirname(__FILE__) . '/foo.tmp';,[object Object],unlink($temp_filename);,[object Object],?>,[object Object],--EXPECT--,[object Object]
Mexendo nas Configurações,[object Object],--TEST--,[object Object],Definindo um fusoparaportabilidade,[object Object],--INI--,[object Object],date.timezone=UTC,[object Object],--FILE--,[object Object],--EXPECT--,[object Object]
Portavel e Seletivo,[object Object],--TEST--,[object Object],Verificando se estamosemumaplataforma de 32 bits...,[object Object],--SKIPIF--,[object Object],<?php,[object Object],if (PHP_INT_SIZE!=4)die('32bit platforms only');,[object Object],?>,[object Object],--FILE--,[object Object],--EXPECT--,[object Object]
Portavel e Seletivo,[object Object],--TEST--,[object Object],Verificando se estamos no Linux...,[object Object],--SKIPIF--,[object Object],<?php,[object Object],if (!stristr(PHP_OS, 'Linux'))die('Linux only');,[object Object],?>,[object Object],--FILE--,[object Object],--EXPECT--,[object Object]
Fui eu!,[object Object],--TEST--,[object Object],Um teste com umaseção de créditos,[object Object],--CREDITS--,[object Object],Jack <jack@phpsp.org.br>,[object Object],#testfest São Paulo on 2009-06-20,[object Object],--FILE--,[object Object],--EXPECT--,[object Object]
Outras sessões,[object Object],--TEST--,[object Object],[--DESCRIPTION--],[object Object],[--CREDITS--],[object Object],[--SKIPIF--],[object Object],[--REQUEST--],[object Object],[--POST-- | --POST_RAW-- | --GZIP_POST-- | --DEFLATE_POST-- | --GET--],[object Object],[--COOKIE--],[object Object],[--STDIN--],[object Object],[--INI--],[object Object],[--ARGS--],[object Object],[--ENV--],[object Object],--FILE-- | --FILEEOF-- | --FILE_EXTERNAL-- | --REDIRECTTEST--,[object Object],[--HEADERS--],[object Object],[--CGI--],[object Object],[--XFAIL--],[object Object],[--EXPECTHEADERS--],[object Object],--EXPECT-- | --EXPECTF-- | --EXPECTREGEX--,[object Object],[--CLEAN--],[object Object]
Roda ai Zé!,[object Object],$ maketests TESTS=path/to/ext/yourextension/tests,[object Object],=====================================================================,[object Object],PHP         : /Users/rdohms/Downloads/src/php-5.3.0RC4/sapi/cli/php ,[object Object],PHP_SAPI    : cli,[object Object],PHP_VERSION : 5.3.0RC4,[object Object],ZEND_VERSION: 2.3.0,[object Object],PHP_OS      : Darwin - Darwin MacDohms.local 9.7.0 Darwin Kernel Version 9.7.0: …,[object Object],INI actual  : /Users/rdohms/Downloads/src/php-5.3.0RC4/tmp-php.ini,[object Object],More .INIs  :  ,[object Object],CWD         : /Users/rdohms/Downloads/src/php-5.3.0RC4,[object Object],Extra dirs  : ,[object Object],VALGRIND    : Not used,[object Object],=====================================================================,[object Object],Running selected tests.,[object Object],PASS Hello World [/Users/rdohms/dev/phpsp/testfest/SaoPauloUG/tests/basic/mytest.phpt] ,[object Object],=====================================================================,[object Object],Number of tests :    1                 1,[object Object],Tests skipped   :    0 (  0.0%) --------,[object Object],Tests warned    :    0 (  0.0%) (  0.0%),[object Object],Tests failed    :    0 (  0.0%) (  0.0%),[object Object],Expected fail   :    0 (  0.0%) (  0.0%),[object Object],Tests passed    :    1 (100.0%) (100.0%),[object Object],---------------------------------------------------------------------,[object Object],Time taken      :    0 seconds,[object Object],=====================================================================,[object Object]
Roda na Janela!,[object Object],TEST_EXECUTABLE_PHP=auto sapi/cli/php run-tests.php path/to/test,[object Object],Bash,[object Object],export TEST_PHP_EXECUTABLE=/mnt/workspace/PHP/php53/sapi/cli/php,[object Object],$TEST_PHP_EXECUTABLE /mnt/workspace/PHP/php53/run-tests.php $*,[object Object]
1 of 23

Recommended

PHP e AJAX: do Request ao Framework by
PHP e AJAX: do Request ao FrameworkPHP e AJAX: do Request ao Framework
PHP e AJAX: do Request ao FrameworkRafael Dohms
1.7K views30 slides
Despertando para o PHP by
Despertando para o PHPDespertando para o PHP
Despertando para o PHPRafael Dohms
2.4K views67 slides
[FISL 16] PHP no Campo de Batalha: Segurança Avançada e Programação Defensiva... by
[FISL 16] PHP no Campo de Batalha: Segurança Avançada e Programação Defensiva...[FISL 16] PHP no Campo de Batalha: Segurança Avançada e Programação Defensiva...
[FISL 16] PHP no Campo de Batalha: Segurança Avançada e Programação Defensiva...Rafael Jaques
9.6K views154 slides
Django: Desenvolvendo uma aplicação web em minutos by
Django: Desenvolvendo uma aplicação web em minutosDjango: Desenvolvendo uma aplicação web em minutos
Django: Desenvolvendo uma aplicação web em minutosRodrigo Nossal
7K views32 slides
Mini curso de django by
Mini curso de djangoMini curso de django
Mini curso de djangorosenclever
1.6K views46 slides
Mini Curso de PHP by
Mini Curso de PHPMini Curso de PHP
Mini Curso de PHPRodrigo Bueno Santa Maria, BS, MBA
2.7K views159 slides

More Related Content

What's hot

Django - Desenvolvimento web ágil com Python by
Django - Desenvolvimento web ágil com PythonDjango - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com PythonIgor Sobreira
8.1K views80 slides
Treinamento Básico de Django by
Treinamento Básico de DjangoTreinamento Básico de Django
Treinamento Básico de DjangoLeandro Zanuz
6.2K views96 slides
Python na Web by
Python na WebPython na Web
Python na WebIgor Sobreira
2.1K views34 slides
Desenvolvimento web com python e django by
Desenvolvimento web com python e djangoDesenvolvimento web com python e django
Desenvolvimento web com python e djangoIgor Sobreira
2.6K views80 slides
Desenvolvendo aplicações web com python e web2py by
Desenvolvendo aplicações web com python e web2pyDesenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2pyGilson Filho
8K views90 slides
Minicurso de Django - Desenvolvimento ágil web com Django e Python by
Minicurso de Django - Desenvolvimento ágil web com Django e PythonMinicurso de Django - Desenvolvimento ágil web com Django e Python
Minicurso de Django - Desenvolvimento ágil web com Django e PythonGuilherme Garcia
3K views79 slides

What's hot(20)

Django - Desenvolvimento web ágil com Python by Igor Sobreira
Django - Desenvolvimento web ágil com PythonDjango - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com Python
Igor Sobreira8.1K views
Treinamento Básico de Django by Leandro Zanuz
Treinamento Básico de DjangoTreinamento Básico de Django
Treinamento Básico de Django
Leandro Zanuz6.2K views
Desenvolvimento web com python e django by Igor Sobreira
Desenvolvimento web com python e djangoDesenvolvimento web com python e django
Desenvolvimento web com python e django
Igor Sobreira2.6K views
Desenvolvendo aplicações web com python e web2py by Gilson Filho
Desenvolvendo aplicações web com python e web2pyDesenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2py
Gilson Filho8K views
Minicurso de Django - Desenvolvimento ágil web com Django e Python by Guilherme Garcia
Minicurso de Django - Desenvolvimento ágil web com Django e PythonMinicurso de Django - Desenvolvimento ágil web com Django e Python
Minicurso de Django - Desenvolvimento ágil web com Django e Python
Guilherme Garcia3K views
Aula03 PHP - Estruturas Condicionais by Daniel Brandão
Aula03 PHP - Estruturas CondicionaisAula03 PHP - Estruturas Condicionais
Aula03 PHP - Estruturas Condicionais
Daniel Brandão2.9K views
Trilhando o Caminho PHP - PHPConf2008 by Rafael Dohms
Trilhando o Caminho PHP - PHPConf2008Trilhando o Caminho PHP - PHPConf2008
Trilhando o Caminho PHP - PHPConf2008
Rafael Dohms1.2K views
Trilhando o caminho PHP [2.0] by Rafael Dohms
Trilhando o caminho PHP [2.0]Trilhando o caminho PHP [2.0]
Trilhando o caminho PHP [2.0]
Rafael Dohms1.3K views
PHP e MySQL para iniciantes by Eduardo Mendes
PHP e MySQL para iniciantesPHP e MySQL para iniciantes
PHP e MySQL para iniciantes
Eduardo Mendes12.5K views
Tutorial Django + Python by Mateus Padua
Tutorial Django + PythonTutorial Django + Python
Tutorial Django + Python
Mateus Padua6.6K views
Desenvolvendo mvp com python by Bruno Rocha
Desenvolvendo mvp com pythonDesenvolvendo mvp com python
Desenvolvendo mvp com python
Bruno Rocha15.3K views
Django Tem Ritmo by italomaia
Django Tem RitmoDjango Tem Ritmo
Django Tem Ritmo
italomaia407 views
PHP Jedi - Boas Práticas e Alta Performance by Felipe Ribeiro
PHP Jedi - Boas Práticas e Alta PerformancePHP Jedi - Boas Práticas e Alta Performance
PHP Jedi - Boas Práticas e Alta Performance
Felipe Ribeiro7.8K views
Aula 02 - Introdução ao PHP by Daniel Brandão
Aula 02 - Introdução ao PHPAula 02 - Introdução ao PHP
Aula 02 - Introdução ao PHP
Daniel Brandão3.5K views
Conceitos básicos PHP by Helton Ritter
Conceitos básicos PHPConceitos básicos PHP
Conceitos básicos PHP
Helton Ritter5.4K views
Curso de php do básico ao avançado by Thiago Carlos
Curso de php do básico ao avançadoCurso de php do básico ao avançado
Curso de php do básico ao avançado
Thiago Carlos582 views

Similar to PHPSP TestFest 2009

Brasiliatestfest by
BrasiliatestfestBrasiliatestfest
Brasiliatestfestpaulovitorbal
566 views20 slides
PHPSP TestFest 2010 by
PHPSP TestFest 2010PHPSP TestFest 2010
PHPSP TestFest 2010Rafael Dohms
1.1K views27 slides
Php Test Fest PHPMS, Maio 2008 by
Php Test Fest PHPMS, Maio 2008Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008zehzinho
715 views24 slides
Qualidade no desenvolvimento de software com PHPUnit by
Qualidade no desenvolvimento de software com PHPUnitQualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnitDiego Tremper
1.3K views36 slides
Sapo Sessions PHP by
Sapo Sessions PHPSapo Sessions PHP
Sapo Sessions PHPJoão Machado
380 views62 slides
Código legado - PHP Conference Brasil - 2014 by
Código legado - PHP Conference Brasil - 2014Código legado - PHP Conference Brasil - 2014
Código legado - PHP Conference Brasil - 2014Michael Castillo Granados
898 views81 slides

Similar to PHPSP TestFest 2009(20)

PHPSP TestFest 2010 by Rafael Dohms
PHPSP TestFest 2010PHPSP TestFest 2010
PHPSP TestFest 2010
Rafael Dohms1.1K views
Php Test Fest PHPMS, Maio 2008 by zehzinho
Php Test Fest PHPMS, Maio 2008Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008
zehzinho715 views
Qualidade no desenvolvimento de software com PHPUnit by Diego Tremper
Qualidade no desenvolvimento de software com PHPUnitQualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnit
Diego Tremper1.3K views
O que há de novo no PHP 5.3 by Jose Berardo
O que há de novo no PHP 5.3O que há de novo no PHP 5.3
O que há de novo no PHP 5.3
Jose Berardo850 views
Memcached, Gearman e Sphinx by Elton Minetto
Memcached, Gearman e SphinxMemcached, Gearman e Sphinx
Memcached, Gearman e Sphinx
Elton Minetto1.4K views
PHPUnit e teste de software by ricardophp
PHPUnit e teste de softwarePHPUnit e teste de software
PHPUnit e teste de software
ricardophp2.4K views
Puppet – Torne Seu Datacenter áGil by jefesrodrigues
Puppet – Torne Seu Datacenter áGilPuppet – Torne Seu Datacenter áGil
Puppet – Torne Seu Datacenter áGil
jefesrodrigues1.1K views
Testando Aplicações com PHPT by Sidney Souza
Testando Aplicações com PHPTTestando Aplicações com PHPT
Testando Aplicações com PHPT
Sidney Souza140 views
Seu framework é melhor pra quê? by Jaime Neto
Seu framework é melhor pra quê?Seu framework é melhor pra quê?
Seu framework é melhor pra quê?
Jaime Neto248 views

More from Rafael Dohms

Application Metrics - IPC2023 by
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023Rafael Dohms
7 views87 slides
How'd we get here? A guide to Architectural Decision Records by
How'd we get here? A guide to Architectural Decision RecordsHow'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision RecordsRafael Dohms
306 views42 slides
Architectural Decision Records - PHPConfBR by
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRRafael Dohms
299 views42 slides
Application Metrics (with Prometheus examples) by
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Rafael Dohms
998 views89 slides
Application metrics - Confoo 2019 by
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019Rafael Dohms
747 views90 slides
Writing code you won’t hate tomorrow - PHPCE18 by
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Rafael Dohms
1.2K views86 slides

More from Rafael Dohms(20)

Application Metrics - IPC2023 by Rafael Dohms
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023
Rafael Dohms7 views
How'd we get here? A guide to Architectural Decision Records by Rafael Dohms
How'd we get here? A guide to Architectural Decision RecordsHow'd we get here? A guide to Architectural Decision Records
How'd we get here? A guide to Architectural Decision Records
Rafael Dohms306 views
Architectural Decision Records - PHPConfBR by Rafael Dohms
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBR
Rafael Dohms299 views
Application Metrics (with Prometheus examples) by Rafael Dohms
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)
Rafael Dohms998 views
Application metrics - Confoo 2019 by Rafael Dohms
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019
Rafael Dohms747 views
Writing code you won’t hate tomorrow - PHPCE18 by Rafael Dohms
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
Rafael Dohms1.2K views
Application Metrics (with Prometheus examples) #PHPDD18 by Rafael Dohms
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
Rafael Dohms757 views
Application metrics with Prometheus - DPC18 by Rafael Dohms
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18
Rafael Dohms1.3K views
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf by Rafael Dohms
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonf
Rafael Dohms3.9K views
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo... by Rafael Dohms
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
Rafael Dohms1.4K views
Composer The Right Way - 010PHP by Rafael Dohms
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
Rafael Dohms3.5K views
Writing Code That Lasts - #Magento2Seminar, Utrecht by Rafael Dohms
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, Utrecht
Rafael Dohms976 views
Composer the Right Way - PHPSRB16 by Rafael Dohms
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16
Rafael Dohms3.9K views
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16 by Rafael Dohms
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16
Rafael Dohms1.4K views
Composer the Right Way - MM16NL by Rafael Dohms
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
Rafael Dohms1.1K views
Composer The Right Way - PHPUGMRN by Rafael Dohms
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
Rafael Dohms1.4K views
Composer the Right Way - PHPBNL16 by Rafael Dohms
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
Rafael Dohms2.6K views
“Writing code that lasts” … or writing code you won’t hate tomorrow. by Rafael Dohms
“Writing code that lasts” … or writing code you won’t hate tomorrow.“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
Rafael Dohms2.5K views
A Journey into your Lizard Brain - PHP Conference Brasil 2015 by Rafael Dohms
A Journey into your Lizard Brain - PHP Conference Brasil 2015A Journey into your Lizard Brain - PHP Conference Brasil 2015
A Journey into your Lizard Brain - PHP Conference Brasil 2015
Rafael Dohms2.2K views
“Writing code that lasts” … or writing code you won’t hate tomorrow. by Rafael Dohms
“Writing code that lasts” … or writing code you won’t hate tomorrow.“Writing code that lasts” … or writing code you won’t hate tomorrow.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
Rafael Dohms967 views

PHPSP TestFest 2009