+ All Categories
Home > Business > Alexandru Bolboaca - Unit Testing from the Trenches

Alexandru Bolboaca - Unit Testing from the Trenches

Date post: 11-May-2015
Category:
Upload: mozaic-works
View: 920 times
Download: 5 times
Share this document with a friend
Popular Tags:
26
Unit Testing From The Trenches Alexandru Bolboaca Alexandru Bolboaca V1.0, because I embrace change V1.0, because I embrace change
Transcript
Page 1: Alexandru Bolboaca - Unit Testing from the Trenches

Unit Testing From The Trenches

Alexandru BolboacaAlexandru BolboacaV1.0, because I embrace changeV1.0, because I embrace change

Page 2: Alexandru Bolboaca - Unit Testing from the Trenches

I write tests because I don't want this to happen

Page 3: Alexandru Bolboaca - Unit Testing from the Trenches

...and I don't want to be this guy

Page 4: Alexandru Bolboaca - Unit Testing from the Trenches

Agenda

Some clarifications

5 practical ideas

Answers to your questions

Page 5: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #1: What is a unit test?

A piece of code that checks a unit from the system under test (SUT)

A unit = a class (basic)A unit = a behavior (advanced)

Page 6: Alexandru Bolboaca - Unit Testing from the Trenches

A unit test

AssertAssertActAct

ArrangeArrange GivenGivenWhenWhenThenThen

Page 7: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #2: Types of tests

Page 8: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #3: When we write tests

Design, Code, Test = Test After

Design, Test, Code = Test First Programming

Test, Code, Design = Test Driven Development

Page 9: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #4: Who writes the tests

Technology-facing tests: Devs

Business facing tests: Analysts and Devs

Critique tests: Testers and Devs

Page 10: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #5: Good unit tests

SimpleFast

ReadableIndependentRepeatableEasy to run

Page 11: Alexandru Bolboaca - Unit Testing from the Trenches

Clarification #6: Write tests for any tech

… … including bash scriptingincluding bash scripting

Page 12: Alexandru Bolboaca - Unit Testing from the Trenches

Anything else to clarify?

Page 13: Alexandru Bolboaca - Unit Testing from the Trenches

5 Practical Ideas

Page 14: Alexandru Bolboaca - Unit Testing from the Trenches

Situation #1

Cost: 12 hrs of businessCost: 12 hrs of businessCause: “a time calculation that was Cause: “a time calculation that was

incorrect for the leap year”incorrect for the leap year”

Page 15: Alexandru Bolboaca - Unit Testing from the Trenches

Practical Idea #1

The The immune systemimmune system of your product of your product

Page 16: Alexandru Bolboaca - Unit Testing from the Trenches

Situation #2

Large proportion of tests that are:

SlowUnpredictable

Page 17: Alexandru Bolboaca - Unit Testing from the Trenches

Practical Idea #2

Page 18: Alexandru Bolboaca - Unit Testing from the Trenches

Situation #3

I measure the development timeI measure the development timeI want the unit test coverage to be 90%I want the unit test coverage to be 90%

Page 19: Alexandru Bolboaca - Unit Testing from the Trenches

Practical Idea #3

Managers measure Running Tested Features

Developers measure coverage

Guideline: Coverage must increase

Page 20: Alexandru Bolboaca - Unit Testing from the Trenches

Situation #4

We have unit tests, BUT:

We extensively use the debugger

Unit tests are based on test plans

Testers still execute repeatedly manual test plans

Page 21: Alexandru Bolboaca - Unit Testing from the Trenches

Practical Idea #4Use automated developer tests to:

Executable Specifications

Replace debugging

Complement learning

Replace repetitive manual testing

Page 22: Alexandru Bolboaca - Unit Testing from the Trenches

Situation #5

Page 23: Alexandru Bolboaca - Unit Testing from the Trenches

Practical Idea #5

Page 24: Alexandru Bolboaca - Unit Testing from the Trenches

Wrap up

I measure RTF/sprintI measure RTF/sprint

Page 25: Alexandru Bolboaca - Unit Testing from the Trenches

Alexandru Bolboaca

[email protected]

@alexboly, alexbolboaca.ro

● Trainings: Unit Testing, TDD, Legacy Code

● Technical Mentoring, Coaching, on-site and remote

Page 26: Alexandru Bolboaca - Unit Testing from the Trenches

Questions

The important thing is not to stop questioningThe important thing is not to stop questioning


Recommended