bdd&tdd
TRANSCRIPT
![Page 1: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/1.jpg)
Anderson Cella
Benhur Griffante
Márcio H. Brufatto
TEST-DRIVEN DEVELOPMENT (TDD)E
BEHAVIOR DRIVEN DEVELOPMENT
![Page 2: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/2.jpg)
TEST-DRIVEN DEVELOPMENT (TDD)ou
DESENVOLVIMENTO DIRIGIDO POR TESTES
![Page 3: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/3.jpg)
HISTÓRIA
• O TDD foi criado por Kenk Beck em 2003.
• A utilização do TDD iniciou com o eXtremme Programming.
![Page 4: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/4.jpg)
O QUE É TDD?
É uma técnica de desenvolvimento de software que se baseia em ciclos de repetição curtos, onde o desenvolvedor cria um caso de teste e depois cria o código para o teste criado.
![Page 5: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/5.jpg)
PROCESSO TDD
Design
Test
Implementação
Test
![Page 6: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/6.jpg)
CICLO TDDRed | Green | Refactor
Red
Refactor Green
![Page 7: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/7.jpg)
REFACTOR
Melhorar o código.
![Page 8: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/8.jpg)
VANTAGENS• Testando primeiro, você sabe exatamente o que seu
sofware precisa fazer;
• Foco: Escrever o código mais simples que resolve o problema;
• Saber quando parar: Teste define quando se atinge o “suficiente”;
• Código mais limpo e organizado;
• Identificar o mais cedo possível problemas de regressão;
• Segurança e refactoring sem medo.
![Page 9: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/9.jpg)
TIPOS DE TESTES
• Teste Unitário
• Teste de Integração
• Teste de Sistema
• Teste de regressão
![Page 10: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/10.jpg)
FERRAMENTAS• .NET: MSTest (Visual Studio), Nunit, csUnit, xUnit.net
• Java: JUnit, Jtest
• Ruby: Test::Unit
• Python: PyUnit
• PHP: PHPUnit, SimpleTest
• JavaScript: JSUnit
• cppUnit
• Cunit
• Delphi: Dunit
• DBFit
• DBUnit
![Page 11: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/11.jpg)
FERRAMENTAS
• HTMLUnit• HTTPUnit• Jmock• Moq• NDbUnit• Nunit• OUNIT• TestNG• VB: VBUnit• XTUnit
![Page 12: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/12.jpg)
BEHAVIOR DRIVEN DEVELOPMENT (BDD)ou
DESENVOLVIMENTO GUIADO POR COMPORTAMENTO
![Page 13: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/13.jpg)
HISTÓRIA• Foi originalmente concebido em 2003, por Dan North
como uma resposta à Test Driven Development.
FRAMEWORKS• Jbehave Java
• Rbehave Ruby
• Cucumber Rspec
![Page 14: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/14.jpg)
O QUE É BDD?
Técnica de desenvolvimento ágil que encoraja colaboração entre desenvolvedores, setores de qualidade e pessoas não-técnicas.
![Page 15: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/15.jpg)
OBJETIVO
Objetivo do BDD é juntar o todas as boas práticas existentes sob uma só bandeira com uma terminologia consistente e sem ambiguidades.
![Page 16: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/16.jpg)
ATINGINDO O OBJETIVO
• Definido um vocabulário comum (Ubiquitous Language);
• Une quem entende de tecnologia com as pessoas que entendem do negócio.
![Page 17: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/17.jpg)
Linguagem do usuário/cliente . Manter uma única linguagem de domínio que seja entendível tanto para os desenvolvedores quanto para o cliente.
UBIQUITOUS LANGUAGE
![Page 18: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/18.jpg)
PRÍNCIPIOS• A área de negócios e a de tecnologia precisam se
referir a mesma parte do sistema da mesma forma- Tudo é comportamento
• Toda parte do sistema precisa ter um valor identificável e verificável para o negócio- Valor de negócio
• Analisar, projetar e planejar tudo de cima a baixo tem retorno decrescente.- O suficiente é suficiente
![Page 19: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/19.jpg)
• Melhor entendimento do negócio do cliente;
• Desenvolvedor, cliente e analista se entendem;
• Redução em erros de entendimento do negócio.
VANTAGENS
![Page 20: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/20.jpg)
TIPOS DE TESTE• Teste Unitário
• Teste de Integração
• Teste de Sistema
• Teste de regressão
• Teste de aceitação
![Page 21: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/21.jpg)
FERRAMENTAS• Java: JBee, Bumblebee, beanSpec, Concordion,
easyb, Instinct, JavaStubs, Jbehave, JDave;
• ASSpec: ActionScript 3;
• Bdoc: RubyonRails;
• C++: CppSpec, Spec-cpp;
• ColdFusion: cfSpec;
• C: Cspec;
• Delphi: dSpec;
![Page 22: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/22.jpg)
FERRAMENTAS• Tecnologias Web: Cucumber;
• Groovy: easyb, Gspec, tepec;
• JavaFX: JFXtras Test;
• JavaScript: Jspec, JSSpec;
• .NET: NBehave , Nspec, Nspecify, Nunit, Specter, StoryQ ;
• PHP: PHPSpec;
• Python: Pyccuracy, Pyhistorian, PyCukes;
![Page 23: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/23.jpg)
CONCLUSÃO• Qualidade no produto final
• Fácil de executar mudanças
• Diminuição de erros em códigos
• Melhor entendimento do negócio
• Todos “falam a mesma língua”
• Criação de padrão
![Page 24: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/24.jpg)
![Page 25: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/25.jpg)
BIBLIOGRAFIAShttp://jefferson.eti.br/?p=96 BDD
http://domaindrivendesign.org/node/132 Ubiquitous Language
http://www.handersonfrota.com.br/ubiquitous-language/ Ubiquitous Language
http://www.slideshare.net/ Slides
http://pt.wikipedia.org/wiki/Test_Driven_Development TDD
http://pt.wikipedia.org/wiki/Behavior_Driven_Development BDD
![Page 26: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/26.jpg)
LIVROS INDICADOS
![Page 27: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/27.jpg)
OBRIGADO !
![Page 28: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/28.jpg)
RSPEC &
CUCUMBER
![Page 29: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/29.jpg)
INSTALAÇÃO TDD & BDD NO RAILS• RSpec
• gem install rspec rspec-rails
• Para utilizar com Rails:
• Dentro do projeto: script/generate rspec
• Cucumber
• gem install cucumber
• Para utilizar com Rails:
• Dentro do projeto: script/generate cucumber
![Page 30: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/30.jpg)
EXEMPLO RSPECscript/generate rspec_model List title:string description:string
![Page 31: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/31.jpg)
EXEMPLO CUCUMBERPara que seja possível executar uma User Storie utilizando o Cucumber, ela precisa ter uma estrutura básica.• Para o cucumber, todas as User Stories referentes a uma
funcionalidade do sistema estarão agrupadas em um arquivo com a extensão .feature
• No início de cada arquivo existe um resumo da funcionalidade com um formato bem simples: um título, qual o problema a ser resolvido, qual ator trabalha nesta história e qual o resultado desejado.
• Logo depois são definidos os cenários, que são as histórias em si, cada arquivo tem pelo menos um cenário.
![Page 32: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/32.jpg)
EXEMPLO CUCUMBER• Cada história, ou cenário é composto por uma descrição ou
título, uma ou mais pré condições, uma ou mais ações e uma ou mais verificações.
![Page 33: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/33.jpg)
EXEMPLO CUCUMBER
Palavras chave apresentadas são:• Feature• Scenario• Given• And• When• Then
![Page 34: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/34.jpg)
EXEMPLO CUCUMBEREstas mesmas palavras podem ser traduzidas para o portugues como:• Funcionalidade• Cenário• Dado• E• Quando• Então
![Page 35: Bdd&tdd](https://reader036.vdocuments.mx/reader036/viewer/2022062706/557cf80bd8b42a071b8b49af/html5/thumbnails/35.jpg)
SITES DAS FERRAMENTAS
http://cukes.info Cucumber
http://rspec.info RSPEC