Testing is a very import concept in Programming not just in Python. Although, we start off writing simple script files with few lines of code. You start getting thousands and millions 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 at different time at company.
All the code changes happing over time at different time 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.
Use of Debugging in Companies
Let’s say you come into a project that has been around for year and you modify something that may modify another part of the app that you deem and think of. You start creating all these bugs with new features that you introduced into the app. The longer that the code stays in a project the more likely it is to be touched by the different developers.
So, you see the problem here and for companies this is a huge problem because you are most likely growing your product and adding more and more lines of code. That means there’s just going to keep making this giant monster that becomes harder and harder to tame and debug. It costs company a lot of money. Luckily for us we have something called testing.
READ MORE C++ Interview Questions and Answers
What does Testing Do?
Testing can help us solve the problems as the name suggests, testing is a method in software development different pieces of the code are checked that they are working 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.
If you want to become a senior developer and if you want to have a long lasting career you really need to master testing because remember every serious company is going to have tests and they’ll want you to write test for your code.
Testing in Python
In python test is just the name of the file that you have with your main python file where you write all of your code. If you have hundred files of Python or modules then each of those modules will have its own test file that you can run test with. The test file is never going to be run in the production. It’s a file that we run to make sure that before we release your main file to production, test file check everything working properly. So, test is only for development.