18
Put fast back in fast feedback Lars Thorup ZeaLake Software Consulting October, 2013

Put "fast" back in "fast feedback"

Embed Size (px)

DESCRIPTION

One of the cornerstones in Agile development is fast feedback. For engineering, "fast" means "instantly" or "in 5 minutes", not "tomorrow" or "this week". Your engineering practices should ensure that you can answer yes to most of the following questions: - Do we get all test results in less than 5 minutes after a commit? - Is our code coverage more than 75% for both front-end and back-end? - Can we start exploratory testing in less than 15 minutes after a commit? - Do all our tests pass more than 90% of our commits? This talk will give you practical advice on how to get to "yes, we get fast feedback".

Citation preview

Page 1: Put "fast" back in "fast feedback"

Put fastback in fast feedbackLars ThorupZeaLake Software Consulting

October, 2013

Page 2: Put "fast" back in "fast feedback"

Who is Lars Thorup?

● Software developer/architect● C#, JavaScript and C++● Test Driven Development

● Coach● Agile engineering practices● Assessing software projects and

companies

● @larsthorup

Page 3: Put "fast" back in "fast feedback"

Fast feedback is important● Cost of change

● Defects found quickly● ...are cheap to fix

● Lower risk● Systems delivered frequently ● ...are easy to adapt to evolving

requirements

● Fast feedback will make you more productive

Page 4: Put "fast" back in "fast feedback"

How are you doing?

Unit test run time seconds few minutes > 10 minutes

Unit test coverage <25% <50% >50%

Integration test run time minutes > 30 minutes hours

Commits per dev per day 10 1 <1

Releases per week 50 1 <1

Visible metrics of this trend lines status no

Page 5: Put "fast" back in "fast feedback"

Real life stories● Slow feedback

● Large insurance system provider

● Nightly builds, Selenium tests only

● 4 hours, usually some failures

● Weekly commits

● Slow feedback● Large online store● Huge number of Selenium

tests● 12 hours, usually >25%

failures

● Fast feedback● Large interactive meetings● Hourly commits● 75% unit test coverage● <5 minute to build, test and

release

● Fast feedback● Same large online store● Daily commits● 75% unit test coverage● <2 minutes to test● 1/10th QA issues

Page 6: Put "fast" back in "fast feedback"

Feedback goals● Slow feedback, if you:

● Get <10% of your code coverage through unit tests

● Manual or nightly builds● Weekly commits● Merge feature branches on

a monthly basis

● Fast feedback: if you● Get >75% of your code

coverage through unit tests● Release on every commit● Commit many times every

day● Avoid branching in the

version control system● ...instead do branch by

abstraction in the code● http://martinfowler.com/bliki/

BranchByAbstraction.html

Page 7: Put "fast" back in "fast feedback"

Show - don't tell● C# unit testing

● nant unittest / TestDriven.NET

● JavaScript unit testing● grunt test:unit / all.test.html

● TeamCity● Fast build, artifacts● Code coverage

Page 8: Put "fast" back in "fast feedback"

Techniques, tools and metrics

Page 9: Put "fast" back in "fast feedback"

Elephant carpaccio● How do you build an elephant - one slice at a time

● Smaller slices give faster feedback

Start Release date

Time

Page 10: Put "fast" back in "fast feedback"

Mocks and stubs● When testing an object X, that depends on an object Y

● replace the real Y with a fake Y

Notifier

EmailSvc

IEmailSvc

EmailSvcStub

NotifierTest

Page 11: Put "fast" back in "fast feedback"

Test-Driven Development

Failingtest

Succeedingtest

Gooddesign Refactor

Test

IdeaThink, talk

● Every TDD microstep gives you fast feedback

Page 12: Put "fast" back in "fast feedback"

Enforce "fast"● Break the build when it's not fast

Page 13: Put "fast" back in "fast feedback"

Tools● JavaScript

● Jasmine● QUnit● SinonJS● GruntJS● Karma● Istanbul

● .NET● NUnit● NSubstitute● NAnt● NCover

● Java● JUnit● Mockito● Cobertura

● C++● Google Test● Google Mock● Mockito++

● Continuous Integration● Jenkins● TeamCity

Page 14: Put "fast" back in "fast feedback"

Metric - commit frequency

Page 15: Put "fast" back in "fast feedback"

Metric - unit test run time

Page 16: Put "fast" back in "fast feedback"

Metric - unit test coverage

Page 17: Put "fast" back in "fast feedback"

Metric - release frequency

Page 18: Put "fast" back in "fast feedback"

It's not hard - now go do it!● This is hard

● SQL query efficiency● Cache invalidation● Scalability● Pixel perfect rendering● Cross-browser compatibility● Indexing strategies● Security● Real time media streaming● 60fps gaming with HTML5

● ... and robust Selenium tests!

● This is not hard● Unit testing● Dependency injection● Automated build and test● Continuous Integration

● Fast feedback will make you more productive

● ... and more happy