TDD with Ruby

10
TDD with Ruby Ismael G Marín C @igmarin

Transcript of TDD with Ruby

Page 1: TDD with Ruby

TDD with RubyIsmael G Marín C

@igmarin

Page 2: TDD with Ruby

Comunidades

• Elixir Bajío (Facebook)

• Bajio on Rails (Facebook)

Page 3: TDD with Ruby

What is the primary goal of TDD?

• One view is the goal of TDD is specification and not validation

In other words, it’s one way to think through your requirements or design before your write your functional code (implying that TDD is both an important agile requirements and agile design

Page 4: TDD with Ruby

–Ron Jeffries

“the goal of TDD is to write clean code that

works.”

Page 5: TDD with Ruby

TDD Cycle• Add a test • Run all the test and see if the new test fails • Write the code • Run test • Refactor code • Repeat

Page 6: TDD with Ruby

Write a failing test

Make the test pass

Refactor

red - green - refactor

Page 7: TDD with Ruby
Page 8: TDD with Ruby

Two levels of TDD• Acceptance TDD (ATDD). With ATDD you write a single

acceptance test, or behavioral specification depending on your preferred terminology, and then just enough production functionality/code to fulfill that test.

• Developer TDD. With developer TDD you write a single developer test, sometimes inaccurately referred to as a unit test, and then just enough production code to fulfill that test.

Page 9: TDD with Ruby
Page 10: TDD with Ruby