200 likes | 315 Views
Learn about the principles and benefits of Test-Driven Development (TDD) from BBC engineers David Craddock, Jack Palfrey, and Tom Canter. Discover the importance of unit testing, TDD best practices, objection handling, and current tools like Cloud9 and Python with a focus on practical application and real-world examples. Explore the development environment at BBC, including Agile practices and continuous integration techniques. Whether you're new to TDD or looking to enhance your skills, this comprehensive guide will help you improve your software testing strategies. Get insights directly from industry professionals and elevate your development approach today!
E N D
TDD at the BBC David Craddock, Jack Palfrey and Tom Canter
Who are we? • David Craddock • Software Engineer • Jack Palfrey • Developer In Test • Tom Canter • Software Engineer
What do we do? Work in the BBC in Salford Quays. David works on the server-side code of Connected Red Button Jack teaches BDD and TDD principles to developers and writes the BDD framework tools we use Tom works on the front-end code of Connected Red Button
Benefits of Tests • Finding problems early • Code coverage upto 75% • Reduce bug fixing time • Monitoring your code base • Gives confidence when low level changes are required • Real low level regression tests • Real documentation that never lies
Test last approach Design Code Test
The TDD way Test Refactor Code
What is TDD • Think about what the test will do • Write tests before code • Tests ‘drive’ • An indication of ‘intent’ • Tests provide a specification and documentation
TDD steps • Implement a single failing test • Watch it fail • Write the simplest code to pass the test • Rerun the test and watch it pass • Refactor the code and tests to remove duplication • Repeat
TDD best practices • Keep your test and model code separate • For every production class have a test class • Write useful tests • Agressively refactor production code • Isolate your tests • Maintain your tests • Tests should test one thing • Don't refactor with a failing test
Today’s tools • Cloud 9 + Python + PyUnit
Development at the BBC • Work in teams with pair programming • Agile planning / task boards / sprints / standups • Source control - branching / commiting / merging • BDD - Behaviour Driven Development • Continuous Integration and automated builds • XP techniques, pairing, TDD, no overtime
Development at the BBC (continued) • Expected to pick up languages ad hoc, you are not solely a 'Java developer' • Regular code reviews and discussions - very collaborative • Regularly get sent on courses on many different technologies • Masters course available • Innovation time available, where you can work on what you want
Work at the BBC • Graduate scheme - a 2 year scheme with 4 x 6 month developer placements • Visit bbc.co.uk/careers/trainee-schemes/digitalmediascheme for more info and to apply, by 28th Feb for this year's intake • Shorter work experience placements are available separately to the graduate scheme.
Practical session: Fizz Buzz • Write a program that prints the integers from 1 to 100. • But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". • For numbers which are multiples of both three and five print "FizzBuzz". • But do this in a test-first (TDD) way