Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Are you testing the right things?

Are you testing the right things?

Esta palestra é resultado de um projeto realizado por meses no GitHub e o ecossistema PHP.
O objetivo é a apresentação de métodos de asserção que o PHPUnit possui que melhoram suíte de testes, inclusive no debugging de erros. Não só métodos, mas também o caminho entre a asserção e a verificação, passagem de argumentos extras, mensagens de erro, etc.
A temática da palestra será a apresentação de blocos de asserções que são comuns, mostrando os benefícios da refatoração de código e melhoria de mensagens de erro.
Serão apresentadas diversas ferramentas para automatizar a refatoração destas asserções.

Avatar for Gabriel Caruso

Gabriel Caruso

May 16, 2018
Tweet

More Decks by Gabriel Caruso

Other Decks in Programming

Transcript

  1. PHPUnit 7.1.5 by Sebastian Bergmann and contributors. . 1 /

    1 ( 100%) Time: 200 ms, Memory: 10.00MB OK (1 tests, 1 assertions)
  2. PHPUnit 7.1.5 by Sebastian Bergmann and contributors. F 1 /

    1 (100%) Time: 505 ms, Memory: 12.00MB There was 1 failure: 1) Tests\TestCase::testShouldNotBeTrue Failed asserting that true is false. /var/www/html/tests/TestCase.php:10 FAILURES! Tests: 1, Assertions: 1, Failures: 1.
  3. $expected == $actual; Asserção O que você espera que seja

    retornado O que foi retornado de fato
  4. true === $expected; Asserção O que você espera que seja

    retornado O que foi retornado de fato