00:0.54 Let's review some of the core concepts around testing,
00:3.31 python pytest and PyCharm. So we saw that we could write test methods that
00:8.67 will exercise parts of our code assert things and verify that our code is working correctly
00:13.14 We decided to use py tests because it's by far the most popular way to
00:18.47 create tests in python. Notice a couple of things the naming matters.
00:23.78 So the methods all start with test underscore and then they can have some huge long
00:28.64 descriptive name, which is really good because if you see the short report,
00:32.07 this test Passed or, this test failed basically.
00:35.1 That's the description of the test.
00:36.78 Right You never call these directly.
00:38.0 So be generous on the names.
00:40.34 Also notice the name of the file table underscore test tests plural.
00:46.03 Never mind. It contains multiple tests that needs to be singular for pytest to
00:50.6 discover it. And we put that file within a folder called tests and we can
00:55.11 just right click on the test folder state run with py test boom,
00:58.25 off it goes. We also saw under the python integrated tools and testing that there
01:5.72 are multiple frameworks we might be using if you go in at a new configuration for
01:10.46 a new project configuration, you run configuration basically you'll see there's actually a lot of
01:14.66 options under this python test section.
01:17.84 We also have talks. So under python test we've got Doc test Nose test 
01:22.42 pytest, twisted trial and unit test, 'tox' is more about setting up an environment than
01:27.16 maybe running py tests for that environment like python 38 than 39 than 310
01:31.66  Again, if you always want to run the same framework or at least
01:35.97 have a default go over to the tools,
01:39.46 then python integrated tools, testing and then choose the one you want.
01:43.44 pytest or unit test is probably the most common choices here.
01:47.54 Then we can just right click and say run pyest in a test file or
01:52.33 in the test directory that will create the run configuration for the default thing.
01:56.14 Super quick and easy. Once you run it will fire up the test runner.
02:0.79 We've already seen the run test window throughout this course,
02:4.25 but now we're seeing it run unit tests with a different output.
02:7.04 Not just the terminal output, but this hierarchical thing.
02:10.23 Understanding the tests, we dive into it a little bit here.
02:13.78 We have the run tests. So rerun the tests as their selected down here.
02:18.5 Right? You can say set up just the failing test and then click that to
02:22.19 rerun it and so on. Or just run the default ones.
02:25.84 This will show passing tests. This little toggle ignored test.
02:30.22 There's a way to say pytest.skip.
02:32.16 Like this might not be passing now,
02:33.95 but let's just put it to the side and we'll come back to it.
02:36.14 So that would show up here normally,
02:37.79 but you can hide those here.
02:40.54 We can rerun the failed tests only.
02:43.94 And then interestingly this one, this one's wild.
02:47.19 So if you turn that on.
02:48.81 What this will do is anytime you make a change to files in the project,
02:52.37 the test files or the files under test this is probably the most important aspect of
02:57.44 it. If you make any change and save it within a second or two 
03:1.04 PyCharm, we'll just rerun that automatically like continuously as you type and press save it
03:6.67 will just keep running the test and keep running the test and keep running the test
03:9.2 That could be really useful if you just want to keep working and just sort
03:12.86 of know red green, it's a thing currently working or is it currently broken according
03:17.45 to the test to be honest.
03:19.3 This is not something that I do the test take a little bit too long to
03:22.72 run and I think it was just kind of stress me out to have those running
03:25.7 all the time. I run the more on demand.
03:27.46 But if this idea appeals to you,
03:29.16 you just click that button and it will automatically run the test on every file,
03:33.11 change locally. You can export the results or import the results here and that will
03:38.61 let you compare them or share them with someone else.
03:41.54 And there's other features as well.
03:42.67 You can see the history, you can explore into the various pieces and see just
03:47.39 the output for that test. It's a really nice test runnerfor the PyCharm.
