Testing 101: Three Rules for Testing at Ombu Labs

28
Testing 101 Ombu Labs, February 2015

Transcript of Testing 101: Three Rules for Testing at Ombu Labs

Testing 101

Ombu Labs, February 2015

Rule #1: If you break the build, fix it.

What’s the build?

Broken build

Passing build

Every pull request has a build

Rule #2: If you fix a bug, add a test.

But how?

rspec

RSpec path/to/project/spec/*

Integration project/spec/requests/*

Services (Unit testing) project/spec/services/*

Models (Unit testing) project/spec/models/*

cucumber

Cucumber path/to/project/features/*

cucumberBecause we don’t use it anymore…

Rule #3: If you add a feature, add a test.

Guidelines

What is the possible input/output of your code?

Test the boundary input parameters for your code

Test the different paths of your code

Apply TDD if it helps you understand the problem

Code defensively, test creatively

How could someone break your code?

Treat your methods like a black box

Thank you!

Questions?