Upload
milfont-consulting
View
1.673
Download
1
Embed Size (px)
DESCRIPTION
Palestra no Marebase2011 com titulo: "Oxente, ramo falar de BDD macho, depois rebola no mato esse codigo réi!"
Citation preview
Oxente, ramo falar de BDD macho, depois rebola no
mato esse codigo réi!Não cuideis que vim trazer a paz à terra; não vim trazer paz, mas pexeira;http://www.bibliaonline.com.br/acf/mt/10
Traditional Software Life Cycle
Software Life Cycle
DevelopmentDevelopment MaintenanceMaintenance
First Deploy - Transition
Traditional Iterations
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
BusinessBusiness RequirementsRequirements AnalysisAnalysis DesignDesign ImplementationImplementation TestTest DeploymentDeployment
Too Late Feedback
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
BusinessBusiness RequirementsRequirements AnalysisAnalysis DesignDesign ImplementationImplementation TestTest DeploymentDeployment
failure when changes happen or feature misunderstood
Laggards Tests
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
BusinessBusiness RequirementsRequirements AnalysisAnalysis DesignDesign ImplementationImplementation TestTest DeploymentDeployment
Fragile coverage and poor code with low Cohesion and high Coupling
Migrating to Agile Iteration
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
Not Enough Time
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
Tests are traditionally discarded when not enough time
Test First Practice
Business Modeling
Implementation
Test
Analysis & Design
Preliminary Iteration(s)
Iter.#1
Process Disciplines
Iterations
Iter.#2
Iter.#n
Iter.#n+1
Iter.#n+2
Iter.#m
Iter.#m+1
Deployment
Requirements
Elaboration TransitionInception Construction
Test First modifies the traditional approach to modeling and analysis
Test Driven Development
"Test-driven development is a way of managing fear during programming."
Kent Beck - Test Driven Development by Example
Daily Development
Standup Meeting
Test
Code Refactoring
Integrate
Pair Up
TDD Cycle
Red Bar PatternsOne Step TestStarter TestExplanation TestLearning TestAnother TestRegression TestBreakDo Over
Fake It (Till you make it) TriangulateObvious ImplementationOne to Many
Green Bar Patterns
Testing Bar PatternsChild TestMock ObjectSelf ShuntCrash Test DummyBroken TestClean Check-Inc
Test DoubleDummyFakeStubsSpiesMocks
The Three A's in TDD
Arrange (create an object)Act (executing a method)Assert (verifying a result)
Refactoring Workbook, Bill Wake
Arrange
var object = Object.create({test:10});
Act
var object = Object.create({test:10});var verified = object.trying("test");
Assert
var object = Object.create({test:10});var verified = object.trying("test");
ok( verified == 10 );
3A
var object = Object.create({test:10});var verified = object.trying("test");ok( verified == 10 );
XUnit
test("Trying contents of a property without throwing exception", function() { var object = Object.create({test:10}) ok( object.trying("test") == 10, "Cool" ); });
What You Are Doing
describe('jsonform',function(){
});
Establish The Context
describe('jsonform',function(){
context('Populate form with json',function(){ }
});
Specify The Behavior
describe('jsonform',function(){
context('Populate form',function(){ it('Json with object nested',function(){ } }
});
Should
describe('jsonform',function(){ context('Populate form',function(){ it('Json with object nested',function(){ jQuery('#jsonform').jsonform(object, function(json) { expect(jQuery(query).val().toString()) .toEqual("1.02.0002"); }); } }});
Behaviour
BDD provides a “ubiquitous language” for analysisDan North
http://dannorth.net/introducing-bdd/
Acceptance
As aI wantso that
Criteria
Given some initial context (the givens),When an event occurs,
Then ensure some outcomes.
ATDDfeature('Using jQuery plugin to populate form', function() { summary( 'In order to submit my form', 'As a user', 'I want populate a form with json' ); scenario('The is stopped with the engine off', function() { var object; given('json object', function() {
}); and('form html', function() {
}); when('I press the start button', function() {
}); then('The expected ', function() { expect(expected).toEqual("expected"); }); });});
ATDDfeature('Using jQuery plugin to populate form', function() { summary( 'In order to submit my form', 'As a user', 'I want populate a form with json' ); scenario('The is stopped with the engine off', function() { var object; given('json object', function() { object = { nested: {id: 2, name: "Teste"}, array_nested: [ {nested: {id: 3, name: "Teste"} } ], description: "Teste", value: "125,67", date: "12/03/1999" }; }); and('form html', function() { var template = "<form action='#' id='jsonform'> \ ...\ </form>"; jQuery(template).appendTo("body"); }); when('I press the start button', function() { jQuery('#jsonform').jsonform(object); }); then('The car should start up', function() { expect(jQuery(query).val().toString()).toEqual("Teste"); }); });});
Daily Development
Standup Meeting
Test
Code Refactoring
Integrate
Pair Up
BDD/TDD Cycle AcceptanceTest
CodeRefactoring
Model Storming
BDD
TDD + DDD (+ATDD)
Transition Frontier Broken
Software Life Cycle
DevelopmentDevelopmentDesenvolvimentoDesenvolvimento
MaintenanceMaintenanceManutençãoManutenção
Transition frontier no longer makes sense
Modeling
Implementation
Test
Analysis & Design
Deployment
RequirementsModeling
Implementation
Test
Analysis & Design
Deployment
RequirementsModeling
Implementation
Test
Analysis & Design
Deployment
Requirements