Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Advanced Live Testing
Augusto Pascutti / Nelson Senna
Advanced Live Testing
Augusto Pascutti / Nelson Senna
Nossa experiência com TDD
Augusto Pascutti / Nelson Senna
Os pilotos
Augusto Pascutti
Twitter: @augustohp
Github: augustohp
Slides: http://bit.ly/augustohp
Blog: http://augustopascutti.com
Nelson Senna
Twitter: @nelson_senna
Github: nelsonsar
Slides: http://bit.ly/nelsonsar
Blog: http://nelsonsar.github.io
O que é um teste?
1 <?php
2
3 namespace App;
4
5 class Download
6 {
7 public function fromUrl($fromUrl, $toFile)
8 {
9 $contents = file_get_...
1 <?php
2
3 namespace App;
4
5 class Download
6 {
7 public function fromUrl($fromUrl, $toFile)
8 {
9 $contents = file_get_...
1 <?php
2
3 namespace App;
4
5 class Download
6 {
7 public function fromUrl($fromUrl, $toFile)
8 {
9 $contents = file_get_...
1 <?php
2
3 namespace App;
4
5 class DownloadTest extends PHPUnit_Framework_TestCase
6 {
7 const DESTINATION_FILE = '/tmp/...
1 <?php
2
3 namespace App;
4
5 class DownloadTest extends PHPUnit_Framework_TestCase
6 {
7 const DESTINATION_FILE = '/tmp/...
Diferentes níveis de teste
1. Unitário (white-box)
2. Integração (white-box, black-box)
3. Acceptance (black-box)
O que é TDD?
–Ron Jeffries
“Código limpo que funciona.”
–Wikipedia: Test-driven development
“… metodologia que se baseia na repetição de
ciclos muito curtos de desenvolvimento.”
...
Um ciclo
Um ciclo
1. Criar um teste (RED)
Um ciclo
1. Criar um teste (RED)
2. Fazer uma mudança pequena (GREEN)
Um ciclo
1. Criar um teste (RED)
2. Fazer uma mudança pequena (GREEN)
3. Refactor
–Kent Beck / Nat Pryce
“O TDD não garante boa arquitetura. Ele dá um
retorno imediato do que, provavelmente, é uma
má arqu...
Por que usar TDD?
Por que usar TDD?
• Evitar que defeito vire falha
• Evitar o “stress loop”
• Aumenta coesão, diminui acoplamento
• É uma f...
Mão na massa?
O que iremos fazer?
Iterações
1. Falha ao salvar um e-mail na newsletter.
2. Validação de email ao salvar.
3. Salvar um e-mail.
http://github.com/PHPSP/Jarbas
Nossa experiência com TDD
Upcoming SlideShare
Loading in …5
×

Nossa experiência com TDD

1,058 views

Published on

Palestra de TDD apresentada no InterconPHP no dia 19/07/2014.

A apresentação discorre rapidamente sobre conceitos básicos do Test Driven Development como:

- A diferença entre teste e teste automatizado;
- Os diferentes tipos de testes;
- O que é TDD;
- Explicação de um ciclo de TDD;
- E o porquê de usar TDD.

O repositório ao final da apresentação faz parte de uma demonstração de algumas iterações feitas pelos apresentadores para ilustrar os ciclos da prática.

  • ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐ has really great writers to help you get the grades you need, they are fast and do great research. Support will always contact you if there is any confusion with the requirements of your paper so they can make sure you are getting exactly what you need.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I think you need a perfect and 100% unique academic essays papers have a look once this site i hope you will get valuable papers, ⇒ www.HelpWriting.net ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Nossa experiência com TDD

  1. 1. Advanced Live Testing Augusto Pascutti / Nelson Senna
  2. 2. Advanced Live Testing Augusto Pascutti / Nelson Senna
  3. 3. Nossa experiência com TDD Augusto Pascutti / Nelson Senna
  4. 4. Os pilotos
  5. 5. Augusto Pascutti Twitter: @augustohp Github: augustohp Slides: http://bit.ly/augustohp Blog: http://augustopascutti.com
  6. 6. Nelson Senna Twitter: @nelson_senna Github: nelsonsar Slides: http://bit.ly/nelsonsar Blog: http://nelsonsar.github.io
  7. 7. O que é um teste?
  8. 8. 1 <?php 2 3 namespace App; 4 5 class Download 6 { 7 public function fromUrl($fromUrl, $toFile) 8 { 9 $contents = file_get_contents($fromUrl); 10 // var_dump($contents); 11 $bytes = file_put_contents( 12 $toFile, 13 $contents 14 ); 15 // var_dump($bytes); 16 return $bytes; 17 } 18 }
  9. 9. 1 <?php 2 3 namespace App; 4 5 class Download 6 { 7 public function fromUrl($fromUrl, $toFile) 8 { 9 $contents = file_get_contents($fromUrl); 10 // var_dump($contents); 11 $bytes = file_put_contents( 12 $toFile, 13 $contents 14 ); 15 // var_dump($bytes); 16 return $bytes; 17 } 18 }
  10. 10. 1 <?php 2 3 namespace App; 4 5 class Download 6 { 7 public function fromUrl($fromUrl, $toFile) 8 { 9 $contents = file_get_contents($fromUrl); 10 // var_dump($contents); 11 $bytes = file_put_contents( 12 $toFile, 13 $contents 14 ); 15 // var_dump($bytes); 16 return $bytes; 17 } 18 }
  11. 11. 1 <?php 2 3 namespace App; 4 5 class DownloadTest extends PHPUnit_Framework_TestCase 6 { 7 const DESTINATION_FILE = '/tmp/test-file'; 8 9 public function tearDown() 10 { 11 unlink(self::DESTINATION_FILE); 12 } 13 14 public function testDownloadCreatesTheFile() 15 { 16 $file = self::DESTINATION_FILE; 17 $this->assertFileNotExists($file); 18 19 $downloader = new Download; 20 $url = 'http://example.org'; 21 $bytesWritten = $downloader->fromUrl($url, $file); 22 23 $this->assertGreaterThan(0, $bytesWritten); 24 $this->assertFileExists($file); 25 } 26 }
  12. 12. 1 <?php 2 3 namespace App; 4 5 class DownloadTest extends PHPUnit_Framework_TestCase 6 { 7 const DESTINATION_FILE = '/tmp/test-file'; 8 9 public function tearDown() 10 { 11 unlink(self::DESTINATION_FILE); 12 } 13 14 public function testDownloadCreatesTheFile() 15 { 16 $file = self::DESTINATION_FILE; 17 $this->assertFileNotExists($file); 18 19 $downloader = new Download; 20 $url = 'http://example.org'; 21 $bytesWritten = $downloader->fromUrl($url, $file); 22 23 $this->assertGreaterThan(0, $bytesWritten); 24 $this->assertFileExists($file); 25 } 26 }
  13. 13. Diferentes níveis de teste 1. Unitário (white-box) 2. Integração (white-box, black-box) 3. Acceptance (black-box)
  14. 14. O que é TDD?
  15. 15. –Ron Jeffries “Código limpo que funciona.”
  16. 16. –Wikipedia: Test-driven development “… metodologia que se baseia na repetição de ciclos muito curtos de desenvolvimento.” https://en.wikipedia.org/wiki/Test-driven_development
  17. 17. Um ciclo
  18. 18. Um ciclo 1. Criar um teste (RED)
  19. 19. Um ciclo 1. Criar um teste (RED) 2. Fazer uma mudança pequena (GREEN)
  20. 20. Um ciclo 1. Criar um teste (RED) 2. Fazer uma mudança pequena (GREEN) 3. Refactor
  21. 21. –Kent Beck / Nat Pryce “O TDD não garante boa arquitetura. Ele dá um retorno imediato do que, provavelmente, é uma má arquitetura.”
  22. 22. Por que usar TDD?
  23. 23. Por que usar TDD? • Evitar que defeito vire falha • Evitar o “stress loop” • Aumenta coesão, diminui acoplamento • É uma forma de documentação
  24. 24. Mão na massa?
  25. 25. O que iremos fazer?
  26. 26. Iterações 1. Falha ao salvar um e-mail na newsletter. 2. Validação de email ao salvar. 3. Salvar um e-mail.
  27. 27. http://github.com/PHPSP/Jarbas

×