...

/

Introduction to Unit Testing

Introduction to Unit Testing

Learn about unit testing.

Now that we have a working pipeline ready, it’s time to reflect on our development journey. We started off with the architecture of the system and decided on the directory structure and code organization. Then we designed and developed the individual components that make up our ml_pipeline library and the top-level pipeline.py code. We trained the iris classifier model successfully using the pipeline. Finally, we extended the pipeline for the AutoMPG regressor. So is there anything left to do? Actually, we’ve left out a major developmental activity, which is the writing and running of unit tests.

Press + to interact

What is unit testing?

Unit testing is the process by which individual units of source code are tested. What is an individual unit? In our case, each class method is a unit that needs to be tested separately. For each unit, the process is as follows:

  1. Set up the test: In the case of class methods, we would instantiate the class with the appropriate parameters.

  2. Run the test: ...