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 - Python Tutorial
From the course: Unit Testing and Test Driven Development in Python
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Supermarket Checkout Kata overview1m 34s
-
(Locked)
Setup and first test case2m 7s
-
(Locked)
Add items, add items prices, and calculate current total6m 55s
-
(Locked)
Add multiple items and calculate total2m 27s
-
(Locked)
Add and apply discounts13m 31s
-
(Locked)
Throw exception when adding an item with no price2m 5s
-
(Locked)
-
-
-