9. Tests
When I'm writing simple automation scripts, I write them as functions and then I called the functions from __main__ as demonstrated earlier in the course. For simple scripts with no dependencies this is fine. However, I also demonstrated how to make modular code, how to build functions which will be permanently reusable. For example, utilities for Serial, TCP, UDP, cryptography and whatever other code you spend time building. By its very nature this code will be modified and improved during its unlimited operational lifetime. If I make it change in my code for one project, does that break the code for use in other projects?
Do a little bit of reading to understand DevOPS. In a modern environment, we might write code, test the individual components (unit testing), test the integrated project, and deploy it to production, all in an automated workflow.
In these exercises, I want to look at mandatory requirements for reusable code, the integration of tests.
There is a quote attributed to Martin Fowler…
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
Before you begin. create a directory to keep example files in and you are ready to code.
This could be on your OneDrive, in these examples, I am using OneDrive\Python\Exercises_09