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

Weitere ähnliche Inhalte

Was ist angesagt?

Django - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com PythonDjango - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com PythonIgor Sobreira
 
Treinamento Básico de Django
Treinamento Básico de DjangoTreinamento Básico de Django
Treinamento Básico de DjangoLeandro Zanuz
 
Desenvolvimento web com python e django
Desenvolvimento web com python e djangoDesenvolvimento web com python e django
Desenvolvimento web com python e djangoIgor Sobreira
 
Desenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2pyDesenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2pyGilson Filho
 
Minicurso de Django - Desenvolvimento ágil web com Django e Python
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
 
PHP: Linguagem + Mysql + MVC + AJAX
PHP: Linguagem + Mysql + MVC + AJAX PHP: Linguagem + Mysql + MVC + AJAX
PHP: Linguagem + Mysql + MVC + AJAX Sérgio Souza Costa
 
Aula03 PHP - Estruturas Condicionais
Aula03 PHP - Estruturas CondicionaisAula03 PHP - Estruturas Condicionais
Aula03 PHP - Estruturas CondicionaisDaniel Brandão
 
Trilhando o Caminho PHP - PHPConf2008
Trilhando o Caminho PHP - PHPConf2008Trilhando o Caminho PHP - PHPConf2008
Trilhando o Caminho PHP - PHPConf2008Rafael Dohms
 
Programação Web com PHP 7.x
Programação Web com PHP 7.xProgramação Web com PHP 7.x
Programação Web com PHP 7.xNorton Guimarães
 
Trilhando o caminho PHP [2.0]
Trilhando o caminho PHP [2.0]Trilhando o caminho PHP [2.0]
Trilhando o caminho PHP [2.0]Rafael Dohms
 
PHP e MySQL para iniciantes
PHP e MySQL para iniciantesPHP e MySQL para iniciantes
PHP e MySQL para iniciantesEduardo Mendes
 
Tutorial Django + Python
Tutorial Django + PythonTutorial Django + Python
Tutorial Django + PythonMateus Padua
 
Desenvolvendo mvp com python
Desenvolvendo mvp com pythonDesenvolvendo mvp com python
Desenvolvendo mvp com pythonBruno Rocha
 
Django Tem Ritmo
Django Tem RitmoDjango Tem Ritmo
Django Tem Ritmoitalomaia
 
PHP Jedi - Boas Práticas e Alta Performance
PHP Jedi - Boas Práticas e Alta PerformancePHP Jedi - Boas Práticas e Alta Performance
PHP Jedi - Boas Práticas e Alta PerformanceFelipe Ribeiro
 
Aula 02 - Introdução ao PHP
Aula 02 - Introdução ao PHPAula 02 - Introdução ao PHP
Aula 02 - Introdução ao PHPDaniel Brandão
 
Conceitos básicos PHP
Conceitos básicos PHPConceitos básicos PHP
Conceitos básicos PHPHelton Ritter
 
Curso de php do básico ao avançado
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çadoThiago Carlos
 

Was ist angesagt? (20)

Django - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com PythonDjango - Desenvolvimento web ágil com Python
Django - Desenvolvimento web ágil com Python
 
Treinamento Básico de Django
Treinamento Básico de DjangoTreinamento Básico de Django
Treinamento Básico de Django
 
Python na Web
Python na WebPython na Web
Python na Web
 
Desenvolvimento web com python e django
Desenvolvimento web com python e djangoDesenvolvimento web com python e django
Desenvolvimento web com python e django
 
Desenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2pyDesenvolvendo aplicações web com python e web2py
Desenvolvendo aplicações web com python e web2py
 
Minicurso de Django - Desenvolvimento ágil web com Django e Python
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
 
PHP: Linguagem + Mysql + MVC + AJAX
PHP: Linguagem + Mysql + MVC + AJAX PHP: Linguagem + Mysql + MVC + AJAX
PHP: Linguagem + Mysql + MVC + AJAX
 
Aula03 PHP - Estruturas Condicionais
Aula03 PHP - Estruturas CondicionaisAula03 PHP - Estruturas Condicionais
Aula03 PHP - Estruturas Condicionais
 
Trilhando o Caminho PHP - PHPConf2008
Trilhando o Caminho PHP - PHPConf2008Trilhando o Caminho PHP - PHPConf2008
Trilhando o Caminho PHP - PHPConf2008
 
Programação Web com PHP 7.x
Programação Web com PHP 7.xProgramação Web com PHP 7.x
Programação Web com PHP 7.x
 
Trilhando o caminho PHP [2.0]
Trilhando o caminho PHP [2.0]Trilhando o caminho PHP [2.0]
Trilhando o caminho PHP [2.0]
 
PHP e MySQL para iniciantes
PHP e MySQL para iniciantesPHP e MySQL para iniciantes
PHP e MySQL para iniciantes
 
Tutorial Django + Python
Tutorial Django + PythonTutorial Django + Python
Tutorial Django + Python
 
MongoDB + PHP
MongoDB + PHPMongoDB + PHP
MongoDB + PHP
 
Desenvolvendo mvp com python
Desenvolvendo mvp com pythonDesenvolvendo mvp com python
Desenvolvendo mvp com python
 
Django Tem Ritmo
Django Tem RitmoDjango Tem Ritmo
Django Tem Ritmo
 
PHP Jedi - Boas Práticas e Alta Performance
PHP Jedi - Boas Práticas e Alta PerformancePHP Jedi - Boas Práticas e Alta Performance
PHP Jedi - Boas Práticas e Alta Performance
 
Aula 02 - Introdução ao PHP
Aula 02 - Introdução ao PHPAula 02 - Introdução ao PHP
Aula 02 - Introdução ao PHP
 
Conceitos básicos PHP
Conceitos básicos PHPConceitos básicos PHP
Conceitos básicos PHP
 
Curso de php do básico ao avançado
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
 

Ähnlich wie PHPSP TestFest 2009

PHPSP TestFest 2010
PHPSP TestFest 2010PHPSP TestFest 2010
PHPSP TestFest 2010Rafael Dohms
 
Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008zehzinho
 
Qualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnitQualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnitDiego Tremper
 
Código legado - PHP Conference Brasil - 2014
Código legado - PHP Conference Brasil - 2014Código legado - PHP Conference Brasil - 2014
Código legado - PHP Conference Brasil - 2014Michael Castillo Granados
 
O que há de novo no PHP 5.3
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.3Jose Berardo
 
Memcached, Gearman e Sphinx
Memcached, Gearman e SphinxMemcached, Gearman e Sphinx
Memcached, Gearman e SphinxElton Minetto
 
PHPUnit e teste de software
PHPUnit e teste de softwarePHPUnit e teste de software
PHPUnit e teste de softwarericardophp
 
Desenvolvendo Extensões PECL
Desenvolvendo Extensões PECLDesenvolvendo Extensões PECL
Desenvolvendo Extensões PECLW3P Projetos Web
 
Puppet – Torne Seu Datacenter áGil
Puppet – Torne Seu Datacenter áGilPuppet – Torne Seu Datacenter áGil
Puppet – Torne Seu Datacenter áGiljefesrodrigues
 
Testando Aplicações com PHPT
Testando Aplicações com PHPTTestando Aplicações com PHPT
Testando Aplicações com PHPTSidney Souza
 
PHP like a super hero
PHP like a super heroPHP like a super hero
PHP like a super heroElton Minetto
 
Seu framework é melhor pra quê?
Seu framework é melhor pra quê?Seu framework é melhor pra quê?
Seu framework é melhor pra quê?Jaime Neto
 
Groovy para javeiros - Migração Painless
Groovy para javeiros - Migração PainlessGroovy para javeiros - Migração Painless
Groovy para javeiros - Migração PainlessRafael Farias Silva
 

Ähnlich wie PHPSP TestFest 2009 (20)

Brasiliatestfest
BrasiliatestfestBrasiliatestfest
Brasiliatestfest
 
PHPSP TestFest 2010
PHPSP TestFest 2010PHPSP TestFest 2010
PHPSP TestFest 2010
 
Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008Php Test Fest PHPMS, Maio 2008
Php Test Fest PHPMS, Maio 2008
 
Qualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnitQualidade no desenvolvimento de software com PHPUnit
Qualidade no desenvolvimento de software com PHPUnit
 
Sapo Sessions PHP
Sapo Sessions PHPSapo Sessions PHP
Sapo Sessions PHP
 
Código legado - PHP Conference Brasil - 2014
Código legado - PHP Conference Brasil - 2014Código legado - PHP Conference Brasil - 2014
Código legado - PHP Conference Brasil - 2014
 
O que há de novo no PHP 5.3
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
 
Memcached, Gearman e Sphinx
Memcached, Gearman e SphinxMemcached, Gearman e Sphinx
Memcached, Gearman e Sphinx
 
Hello SAFE World!!!
Hello SAFE World!!!Hello SAFE World!!!
Hello SAFE World!!!
 
Ganhando tempo com casos de testes
Ganhando tempo com casos de testesGanhando tempo com casos de testes
Ganhando tempo com casos de testes
 
PHPT
PHPTPHPT
PHPT
 
PHPUnit e teste de software
PHPUnit e teste de softwarePHPUnit e teste de software
PHPUnit e teste de software
 
Desenvolvendo Extensões PECL
Desenvolvendo Extensões PECLDesenvolvendo Extensões PECL
Desenvolvendo Extensões PECL
 
Puppet – Torne Seu Datacenter áGil
Puppet – Torne Seu Datacenter áGilPuppet – Torne Seu Datacenter áGil
Puppet – Torne Seu Datacenter áGil
 
Aprofunde se no php 5.3
Aprofunde se no php 5.3Aprofunde se no php 5.3
Aprofunde se no php 5.3
 
Php FrameWARks - sem CakePHP
Php FrameWARks - sem CakePHPPhp FrameWARks - sem CakePHP
Php FrameWARks - sem CakePHP
 
Testando Aplicações com PHPT
Testando Aplicações com PHPTTestando Aplicações com PHPT
Testando Aplicações com PHPT
 
PHP like a super hero
PHP like a super heroPHP like a super hero
PHP like a super hero
 
Seu framework é melhor pra quê?
Seu framework é melhor pra quê?Seu framework é melhor pra quê?
Seu framework é melhor pra quê?
 
Groovy para javeiros - Migração Painless
Groovy para javeiros - Migração PainlessGroovy para javeiros - Migração Painless
Groovy para javeiros - Migração Painless
 

Mehr von Rafael Dohms

The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024Rafael Dohms
 
Application Metrics - IPC2023
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023Rafael Dohms
 
How'd we get here? A guide to Architectural Decision Records
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
 
Architectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRRafael Dohms
 
Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Rafael Dohms
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019Rafael Dohms
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Rafael Dohms
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Rafael Dohms
 
Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Rafael 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
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHPKonfRafael 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...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...Rafael Dohms
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHPRafael Dohms
 
Writing Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtRafael Dohms
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Rafael 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
“Writing code that lasts” … or writing code you won’t hate tomorrow. - #PHPSRB16Rafael Dohms
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NLRafael Dohms
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNRafael Dohms
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Rafael 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.
“Writing code that lasts” … or writing code you won’t hate tomorrow.Rafael Dohms
 
A Journey into your Lizard Brain - PHP Conference Brasil 2015
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 2015Rafael Dohms
 

Mehr von Rafael Dohms (20)

The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024The Individual Contributor Path - DPC2024
The Individual Contributor Path - DPC2024
 
Application Metrics - IPC2023
Application Metrics - IPC2023Application Metrics - IPC2023
Application Metrics - IPC2023
 
How'd we get here? A guide to Architectural Decision Records
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
 
Architectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBRArchitectural Decision Records - PHPConfBR
Architectural Decision Records - PHPConfBR
 
Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)Application Metrics (with Prometheus examples)
Application Metrics (with Prometheus examples)
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019Application metrics - Confoo 2019
Application metrics - Confoo 2019
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
 
Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18
 
“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
“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. - 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...
“Writing code that lasts” … or writing code you won’t hate tomorrow. - PHP Yo...
 
Composer The Right Way - 010PHP
Composer The Right Way - 010PHPComposer The Right Way - 010PHP
Composer The Right Way - 010PHP
 
Writing Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, UtrechtWriting Code That Lasts - #Magento2Seminar, Utrecht
Writing Code That Lasts - #Magento2Seminar, Utrecht
 
Composer the Right Way - PHPSRB16
Composer the Right Way - PHPSRB16Composer the Right Way - PHPSRB16
Composer the Right Way - 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“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
 
Composer the Right Way - MM16NL
Composer the Right Way - MM16NLComposer the Right Way - MM16NL
Composer the Right Way - MM16NL
 
Composer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRNComposer The Right Way - PHPUGMRN
Composer The Right Way - PHPUGMRN
 
Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16Composer the Right Way - PHPBNL16
Composer the Right Way - PHPBNL16
 
“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.
“Writing code that lasts” … or writing code you won’t hate tomorrow.
 
A Journey into your Lizard Brain - PHP Conference Brasil 2015
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
 

PHPSP TestFest 2009

  • 1. Slides baseados no trabalho de SebastianBergmann, traduzido por José Ricardo (PHPMS) e adaptado por Silvano Girardi (PHPSC) Original: http://sebastian-bergmann.de/talks/
  • 2. Olá eu sou a TestFest Objetivos Aumentar a abrangência do código do interpretador de PHP (com testes) Motivar usuários a participar, (re|con)tribuir com o PHP Unir e motivar membros do grupo de usuário Qualificar o participante com uma nova ferramenta Atividade Global Em 2009: Países de todo mundo já realizaram TestFests PHPSP: Primeiro voluntário do Brasil e Segundo a realizar um testfest Próximas oportunidades PHPBR: TestFest durante o FISL (24 a 27/Junho)
  • 3. Como será nosso dia? Preparação Palestra e apresentação ao PHPT Instalação de VMs para trabalho Configurações Escolha Escolher áreas que iremos focar Dividir em grupos de trabalho MadCodingSkillz Time Escrever testes Testar testes Finalização Verificar impacto (%) Commitar testes para repositório SVN do PHP
  • 4. PHPT Cada arquivo .phpt possui um unico teste Cada teste é executado por um processo separado Isolamento total do teste Configuração do PHP independente para cada teste A suite de testes sobrevive a erros fatais, segfaults, etc.. PHPT: http://phpt.info
  • 5. Dando nome ao seu filho Testes queilustramfalhasreportadas (bugs)‏ bug<bugid>.phpt Testes de comportamentobásico de umafunção <functionname>_basic.phpt Testes de comportamentoerrôneo de umafunção <functionname>_error.phpt Testes de variações no comportamento de umafunção <functionname>_variation.phpt Testes variadosparaextensões <extname><no>.phpt
  • 6. O Teste mais simples do mundo --TEST-- Hello World --FILE-- Hello World --EXPECT-- Hello World
  • 7. Agora com PHP --TEST-- Hello World --FILE-- <?php print'Hello World'; ?> --EXPECT-- Hello World
  • 8.
  • 10. %c - um character
  • 15.
  • 16. Limpando a sujeira --TEST-- Removendoarquivostemporários --FILE-- <?php $temp_filename = dirname(__FILE__) . '/foo.tmp'; $fp = fopen($temp_filename, 'w'); fwrite($fp, 'bar'); fclose($fp); ?> --CLEAN-- <?php $temp_filename = dirname(__FILE__) . '/foo.tmp'; unlink($temp_filename); ?> --EXPECT--
  • 17. Mexendo nas Configurações --TEST-- Definindo um fusoparaportabilidade --INI-- date.timezone=UTC --FILE-- --EXPECT--
  • 18. Portavel e Seletivo --TEST-- Verificando se estamosemumaplataforma de 32 bits... --SKIPIF-- <?php if (PHP_INT_SIZE!=4)die('32bit platforms only'); ?> --FILE-- --EXPECT--
  • 19. Portavel e Seletivo --TEST-- Verificando se estamos no Linux... --SKIPIF-- <?php if (!stristr(PHP_OS, 'Linux'))die('Linux only'); ?> --FILE-- --EXPECT--
  • 20. Fui eu! --TEST-- Um teste com umaseção de créditos --CREDITS-- Jack <jack@phpsp.org.br> #testfest São Paulo on 2009-06-20 --FILE-- --EXPECT--
  • 21. Outras sessões --TEST-- [--DESCRIPTION--] [--CREDITS--] [--SKIPIF--] [--REQUEST--] [--POST-- | --POST_RAW-- | --GZIP_POST-- | --DEFLATE_POST-- | --GET--] [--COOKIE--] [--STDIN--] [--INI--] [--ARGS--] [--ENV--] --FILE-- | --FILEEOF-- | --FILE_EXTERNAL-- | --REDIRECTTEST-- [--HEADERS--] [--CGI--] [--XFAIL--] [--EXPECTHEADERS--] --EXPECT-- | --EXPECTF-- | --EXPECTREGEX-- [--CLEAN--]
  • 22. Roda ai Zé! $ maketests TESTS=path/to/ext/yourextension/tests ===================================================================== PHP : /Users/rdohms/Downloads/src/php-5.3.0RC4/sapi/cli/php PHP_SAPI : cli PHP_VERSION : 5.3.0RC4 ZEND_VERSION: 2.3.0 PHP_OS : Darwin - Darwin MacDohms.local 9.7.0 Darwin Kernel Version 9.7.0: … INI actual : /Users/rdohms/Downloads/src/php-5.3.0RC4/tmp-php.ini More .INIs : CWD : /Users/rdohms/Downloads/src/php-5.3.0RC4 Extra dirs : VALGRIND : Not used ===================================================================== Running selected tests. PASS Hello World [/Users/rdohms/dev/phpsp/testfest/SaoPauloUG/tests/basic/mytest.phpt] ===================================================================== Number of tests : 1 1 Tests skipped : 0 ( 0.0%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 0 ( 0.0%) ( 0.0%) Expected fail : 0 ( 0.0%) ( 0.0%) Tests passed : 1 (100.0%) (100.0%) --------------------------------------------------------------------- Time taken : 0 seconds =====================================================================
  • 23. Roda na Janela! TEST_EXECUTABLE_PHP=auto sapi/cli/php run-tests.php path/to/test Bash export TEST_PHP_EXECUTABLE=/mnt/workspace/PHP/php53/sapi/cli/php $TEST_PHP_EXECUTABLE /mnt/workspace/PHP/php53/run-tests.php $*
  • 24. Ambientes Versão para testes: PHP 5.3.0RC4 Ambientes disponíveis Virtual Machine de Ubuntu (Virtual Box) Windows (run-tests.php) Seu ambiente local já compilado
  • 25. Regras Tudo em inglês!
  • 26. Apoio
  • 28. License This presentation material is published under the Attribution-Share Alike 3.0 Unported license. You are free: to Share – to copy, distribute and transmit the work. to Remix – to adapt the work. Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights.
  • 29. Licença Este material paraapresentaçãoépublicado sob a licença “Attribution-Share Alike 3.0 Unported”. Vocêélivrepara: Compartilhar – copiar, distribuiretransmitirotrabalho. Alterar – adaptarotrabalho. Sob as seguintescondições: Atribuição. Vocêdeveatribuirotrabalhonamaneiraespecificadapeloautoroulicenciador (masnão de maneira a sugerirqueelesteapóiamvocêou a maneiracomovocêutilizaotrabalho). Distribuadamesma forma. Se vocêalterar, transformarouconstruiralgobaseando-se nestetrabalho, vocêdevedistribuirotrabalhoresultanteapenas sob a mesmalicença, umalicença similar oucompatível. Para qualquerreusooudistribuição, vocêdevedeixarclaroaosoutrosostermos de licenciamentodestetrabalho. Qualqueruma das condiçõesacimapode ser ignorada se vocêobtiver a permissões do proprietário dos direitosautorais. Nada nestalicençadanificaourestringeosdireitosmorais do autor.