Date post: | 11-May-2015 |
Category: |
Business |
Upload: | mozaic-works |
View: | 920 times |
Download: | 5 times |
Unit Testing From The Trenches
Alexandru BolboacaAlexandru BolboacaV1.0, because I embrace changeV1.0, because I embrace change
I write tests because I don't want this to happen
...and I don't want to be this guy
Agenda
Some clarifications
5 practical ideas
Answers to your questions
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)
A unit test
AssertAssertActAct
ArrangeArrange GivenGivenWhenWhenThenThen
Clarification #2: Types of tests
Clarification #3: When we write tests
Design, Code, Test = Test After
Design, Test, Code = Test First Programming
Test, Code, Design = Test Driven Development
Clarification #4: Who writes the tests
Technology-facing tests: Devs
Business facing tests: Analysts and Devs
Critique tests: Testers and Devs
Clarification #5: Good unit tests
SimpleFast
ReadableIndependentRepeatableEasy to run
Clarification #6: Write tests for any tech
… … including bash scriptingincluding bash scripting
Anything else to clarify?
5 Practical Ideas
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”
Practical Idea #1
The The immune systemimmune system of your product of your product
Situation #2
Large proportion of tests that are:
SlowUnpredictable
Practical Idea #2
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%
Practical Idea #3
Managers measure Running Tested Features
Developers measure coverage
Guideline: Coverage must increase
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
Practical Idea #4Use automated developer tests to:
Executable Specifications
Replace debugging
Complement learning
Replace repetitive manual testing
Situation #5
Practical Idea #5
Wrap up
I measure RTF/sprintI measure RTF/sprint
Alexandru Bolboaca
@alexboly, alexbolboaca.ro
● Trainings: Unit Testing, TDD, Legacy Code
● Technical Mentoring, Coaching, on-site and remote
Questions
The important thing is not to stop questioningThe important thing is not to stop questioning