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.
Setup and first test case - Python Tutorial
From the course: Unit Testing and Test Driven Development in Python
Setup and first test case
- [Instructor] I've created a new project in PyCharm called Checkout, and using Python 3 virtual environment, I set up for PyTest. I already have a simple unit test and a PyTest run configuration set up to verify the product is ready to go. In the right-hand window, I have a to-do list with all the test cases that I know at this point, and they're ordered starting with the simplest test case first. So now I should be ready to start the test-driven development loop of Red/Green/Refactor. You always start in the red phase. So the first thing I need to do is implement a failing unit test. The first test case is to simply verify that I can create an instance of the new Checkout class. I'm going to update the simple test case I have now to do that. I immediately get warnings from the IDE that the Checkout reference cannot be resolved as it doesn't exist yet. This meets the requirement of having a failing unit test, so I'll go ahead and transition to the green phase and make this pass. I'll…
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)
-
-
-