Date post: | 08-May-2015 |
Category: |
Technology |
Upload: | lars-thorup |
View: | 301 times |
Download: | 1 times |
Put fastback in fast feedbackLars ThorupZeaLake Software Consulting
October, 2013
Who is Lars Thorup?
● Software developer/architect● C#, JavaScript and C++● Test Driven Development
● Coach● Agile engineering practices● Assessing software projects and
companies
● @larsthorup
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
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
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
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
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
Techniques, tools and metrics
Elephant carpaccio● How do you build an elephant - one slice at a time
● Smaller slices give faster feedback
Start Release date
Time
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
Test-Driven Development
Failingtest
Succeedingtest
Gooddesign Refactor
Test
IdeaThink, talk
● Every TDD microstep gives you fast feedback
Enforce "fast"● Break the build when it's not fast
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
Metric - commit frequency
Metric - unit test run time
Metric - unit test coverage
Metric - release frequency
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