Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

BDD e TDD (Café Ágil)

on

  • 2,224 views

 

Statistics

Views

Total Views
2,224
Views on SlideShare
2,213
Embed Views
11

Actions

Likes
3
Downloads
23
Comments
0

4 Embeds 11

http://candidosalesg.wordpress.com 7
http://candidosg.com 2
http://flavors.me 1
http://us-w1.rockmelt.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

BDD e TDD (Café Ágil) BDD e TDD (Café Ágil) Presentation Transcript

  • Bdd e Tdd garantia de qualidade
  • Daniel Lopes @danielvlopes
  • e-Genial cursos area consultoria | desenvolvimento | UI
  • voltando . . .
  • Software !
  • DEADLINE 48 horas
  • BUGS ZERO
  • CÓDIGO !
  • Sou o cara !!!
  • ! PESQUISAR
  • Software = Automatização
  • user = User.new user.do_something
  • user = User.new x = user.do_something puts x
  • user = User.new x = user.do_something if x == "magic" puts "OK" else puts "FAIL" end
  • user = User.new x = user.do_something if x == "magic" puts "OK" else raise "FAIL" end
  • user = User.new x = user.do_something unless x == "magic" raise "FAIL" end
  • user = User.new x = user.do_something raise "FAIL" unless x == "magic"
  • def assert(expr) raise "Fail" unless expr end
  • class UserTest < TestUnit def test_do_something user = User.new assert user.do_something == "magic" end end
  • Test::Unit
  • Automatização ?
  • Automatização ?
  • def create(login, password, remember_me, auth_token) current_user = User.authenticate(login, password) if current_user.logged_in? if remember_me current_user.remember_me! cookies[:auth_token] = { :value => current_user.remember_token , :expires => current_user.remember_token_expires_at } end redirect_to home_page else redirect_to login_page end end
  • def test_create session = User.new.create(...) assert ??? end
  • Teste
  • Teste
  • Teste Código
  • Teste Código
  • Código bonito
  • Código TESTÁVEL
  • NT BE CK KE
  • Test Driven Dev.
  • Test Driven Dev.
  • ClientDetailsValidatorTest test_fail_with_missing_name test_fail_with_missing_title assert ["missing name"], client.errors ☹
  • Código = Comunicação
  • Trecho do vídeo http://bigthink.com/ideas/21596
  • def test_fail_with_missing_name assert_equal "missing name", client.errors.first end
  • it should fail without name client errors should include "missing name" end
  • N ORTH DAN
  • Test method como sentenças
  • Template simples de sentenças = foco
  • Nomes de testes expressivos
  • “Behaviour” é mais útil que “test”
  • eli msky David Ch
  • RSpec
  • describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  • describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  • describe Client it should fail without name client errors should include “missing name”
  • Teste como documentação
  • Teste como documentação
  • Requisitos do software?
  • Requisitos = Comportamento
  • In order to As I want
  • In order to use the app As a guest I want register
  • Detalhamento ou Passos
  • Given When Then
  • Given I am on signup page When I fill email with “jonh@gmail.com” And fill password with “123456” Then I should see a success message
  • He lle søy As lak
  • Cucumber
  • # language: en Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario Outline: Add two numbers Given I have entered 10 And I have entered 5 When I press add Then the result should be 15
  • Before do @calc = Calculator.new end Given /I have entered (d+)/ do |n| @calc.push n.to_i end When /I press (w+)/ do |op| @result = @calc.send op end Then /the result should be (.*)/ do |result| @result.should == result.to_f end
  • Mas meu projeto é web ...
  • Behavior Driven Development
  • Behavior Driven Development
  • voltando . . .
  • ☐ CÓDIGO ☐ BUGS ☐ REQUISITOS ☐ DOC’s
  • ☑ CÓDIGO ☑ BUGS ☑ REQUISITOS ☑ DOC’s
  • DEADLINE
  • Por onde começo ?
  • CURSOS egenial.com.br/cursorails egenial.com.br/imersaorubyonrails CONTATOS twitter @danielvlopes danielvlopes@gmail.com