tdd with rspec
TRANSCRIPT
About me• Rachid Calazans de Viveiros
• Working at Piggo
• Graduated in Systems Analysis -
CESMAC - 2011
• Post-Graduated in Mobile Application
Development for Technology
(CESAR.edu - PE)
• Addicted to Tests
• Facebook: rachid.calazans
• E-mail: [email protected]
• It's a software development process;
• Began in the 90s by Kent Beck;
• It’s the practise of test and design;
Advantages
• Your project is covered by a suite of automated tests;
• Loss of fear of changing the code;
• Improvement in your code design;
• Was born in 2005 by Steven Baker, Dave Astels
and Aslak Hellesoy;
• It’s a popular test framework in Ruby world;
• Behaviour Driven Development - BDD;
describe()
• As the name says, describe the
behaviour;
• Can receive any kind of object;
• Can pass a second parameter;
it()
• Specifies an example of code;
• Can or cannot define the expectations
from the object or the behaviour;
Expectations
Has a lot of types:
• be / be_nil;
• be_true / be_false;
• be_instance_of / be_an_instance_of;
• be_a / be_an / be_kind_of;
• eq / eql / equal / ==;
• change;
• …
Advantages
• Could use User stories;
• Build a nice documentation even when running the tests;
• Easy to understand and implement the tests;
References• http://tableless.com.br/tdd-por-que-usar/
• http://agiledata.org/essays/tdd.html
• http://searchsoftwarequality.techtarget.com/definition/test-driven-development
• http://en.wikipedia.org/wiki/Test-driven_development
• http://betterspecs.org/br/
• http://rspec.info/
• http://blog.teamtreehouse.com/an-introduction-to-rspec
• http://pivotallabs.com/testing-strategies-with-rspec/
• rspec-quickguide
• Cucumber e Rspec - Construa aplicações Ruby com testes e especificações