Join Simon Allardice for an in-depth discussion in this video Creating a test, part of Programming Foundations: Test-Driven Development.
- [Voiceover] I'll talk later about how…you might add unit tests to an existing code base,…but I'm going to start first from a completely blank slate…with a TDD test-first mindset, to write a test…before I write any application code.…So I'm beginning with nothing, no code written at all,…and let's say what I have in mind is…to make a very simple banking application.…Okay, I get it, that's a little conventional,…it's a little dull, but I'm not looking…to make a cool project here,…I'm looking for clarity on these ideas,…and with a bank account we have concepts…everybody understands, like balances, withdrawals,…deposits, and so on.…
Now you might have done a little bit…of upfront object oriented designs,…sketch some things on a white board,…or even have a UML diagram,…or some use cases and user stories…and that would be fantastic…because those would make it much easier…to come up with your test, but let us begin…by imagining the simplest bank account class in the world,…and even a very straightforward UML version of this.…
The course explores the jargon of TDD—test suites, test harness, mock and stub objects, and more—and covers how TDD is used in the most common programming languages and environments. Plus learn to create, run, and manage the tests and move to a test-first mindset.
- What is test-driven development?
- Using unit testing frameworks
- Creating tests
- Using assertions
- Creating multiple test methods
- Naming unit tests and test methods
- Testing return values
- Setting up and tearing down
- Introducing mock objects
- Measuring code coverage