From the course: Unit Testing and Test Driven Development in Python

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Supermarket Checkout Kata overview

Supermarket Checkout Kata overview

- [Instructor] In this section of the course, I'll be performing another hands-on test-driven development coding session. For this example, I'll be implementing the supermarket checkout code kata. In this kata, I'll be implementing a checkout class that maintains a list of items that are being added during a checkout at a supermarket. This class should provide interfaces for setting the price on individual items, adding individual items to the checkout, calculating the current total cost from all the items that have been added, and applying optional discount rules when there are N number of a specific item type, i.e., three for a dollar. The checkout class has the following test cases that I'll go through as I'm implementing the class with TDD. The first and simplest test case is for creating an instance of the checkout class. Next is the ability to add an item price, then adding an individual item to the list of checkout items, then calculating the current total, then adding multiple…

Contents