Hello.
And let's talk about testing.
Testing, you see, is an important concept in programming, not just Python.
Although we start off writing simple script files with few lines of code, when we start getting into
the real world, you start getting thousands and millions of lines of code.
Hundreds of Python files worked on by many people from different divisions in a company, and most likely
all of them starting a different time.
The company.
All the code changes happening over time at different times as people work on the project, as the complexity
of the code and the size of the code increases.
It becomes harder and harder for someone to fix a bug that may arise.
Let's say you come into a project that has been around for years.
You may modify something that may modify another part of the app that you didn't even think of, and
you start creating all these bugs with new features that you introduce into the app.
The longer that the code stays in a project, the more likely it is to be touched by different developers.
So you see the problem here, right?
For companies, this is a huge problem because you're most likely always growing your product and adding
more and more lines of code.
That means that there's just going to keep making this giant monster that becomes harder and harder
to tame and debug.
And it costs companies a lot of money.
Luckily for us, we have something called testing.
And testing can help us solve this problem.
As the name suggests, testing is a method in software development where individual units of source
code, such as functions, are tested to see whether they work properly.
Although it may not be a big part of a coding interview, a lot of companies usually don't think about
testing when interviewing people.
It becomes more and more important as you go through your career.
For example, in my case, when I first started out as a programmer, I didn't know that much about
testing before I got hired.
But the importance of testing grew more and more as I progressed through my career, and it's one of
those things that has made me a better developer.
So if you want to become a senior programmer, and if you want to have a long lasting career, you really
need to master the skill.
Because remember, every serious company is going to have tests and they'll want you to write tests
for your code.
So let's explore this idea of testing a little bit more.
You see, a test is simply another Python file.
Now, in my case over here, I have a main pie and a test pie file on my desktop.
Right here.
Usually you have a test file like this accompanying one of your files.
So for example, if you had 100 files of Python or modules, then each of those modules will have its
own test file that you can run tests with.
Now, this file that we're going to be writing never actually runs in production.
It's a file that we run to make sure that before we release this main file to production, that everything
is working properly.
So this is only for development, but we would never actually.
Well, the customers will never see this file.
Now before we actually start writing some tests, I do want to remind you that we did learn a few ways
to debug our code.
Right?
We learned about things like piloting.
That we installed in our Visual Studio code to link to our code and check the syntax and small errors
as we type our code.
We also saw how the online ripple that we used use another thing called Pi Flex, which is just another
lender.
And then we also saw that pie chart.
Our ID also had built in lending.
We also learned that we have something called Auto Pep eight.
Or Pep eight, which is the standard style guide for Python.
And this allows us to make sure that our code meets a style that the Python community has agreed on.
These are the simple tools that allow our code to be checked for simple styling issues or simple mistakes,
such as not declaring a variable.
But these only get you so far.
And testing is a higher level up a way to after you do lifting after you do something like pep eight,
after you've met all those requirements and your file runs.
Testing is a way to actually check even more of your code.
So how do we write these tests that I keep talking about and not coding?
Well, let's find out.
Luckily for us, there's a built in module from the standard library that we can use.
And it's called.
Unit test.
So in the next video, we're going to start writing some tests, writing some sample code, and show
you exactly how they benefit us as programmers.
I'll see you in the next one.