Join Simon Allardice for an in-depth discussion in this video Naming unit tests and test methods, part of Programming Foundations: Test-Driven Development.
- [Voiceover] If you've been in programming…for more than about five minutes,…you'll know that naming conventions…can become almost a religious issue.…But, with unit testing,…there's a bit more importance to it…than just personal, or team,…or even company preference.…Because, depending on the language,…the names that you use can make the difference…as to whether you're test even runs.…I'm going to show simple examples…in four different languages in the next few minutes.…But it is objectively worthwhile for us to begin…by showing some Java and JUnit.…Simply because that's where most of the other…xUnit testing frameworks took their leap.…
So first let's talk about creating new unit tests.…So in the examples I've done so far,…I've had the BankAccount class,…and its corresponding BankAccountTest class.…And this isn't exactly a rule,…but a very good guideline to begin with…is that you would create a separate unit test,…a separate class,…for each new class you write in your project.…So when we were about to add a BankAccount class,…
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