Automation of Testing

Learn how to automate your project's testing and evaluate how well it's tested.

Overview

As we develop machine learning projects, ensuring that our code is reliable and free of errors is important. One way to do this is through testing automation, which involves using tools and techniques to automate the testing process.

This lesson will discuss code coverage and continuous integration, two important concepts in testing automation. Code coverage helps us understand how much of our code is being tested, while continuous integration allows us to automatically build, test, and deploy our code with each change. Using these techniques, we can ensure that our code works as intended and catch any issues early on in the development process.

Test coverage

Test coverage refers to the amount of code tested during the testing process. It helps us understand how much of our code is being tested and identify any areas that may not be thoroughly tested. By having a high test coverage, we can have confidence in the reliability of our code and ensure that it performs as expected.

Note: Test coverage is an important indicator regarding simplicity, quality, and effectiveness in software testing.

Test coverage and code coverage are often used interchangeably, but some people distinguish between the two terms. Test coverage is a metric reflecting the amount of codebase used when running a complete set of tests. More tests can help us discover new bugs in our code more quickly, especially if the tests are well-designed and cover many scenarios.

What does test coverage do?

  • Determine uncovered areas: By calculating test coverage, we can easily identify the areas in the software that the current set of test cases has not tested.

  • Improve test cases: This process helps to create more test cases that are needed to increase the software’s coverage and ensure it works as intended.

  • Measure quality: Test coverage provides a quantitative measure of the testing efforts and can indirectly indicate the software’s quality.

  • Eliminate inefficient tests: It also helps to eliminate test cases that do not contribute to increasing coverage, making the testing process more efficient and focused.

Usually, we use line-wise coverage: a simple ratio between the number of lines covered by tests to the total number of lines in the project.

Get hands-on with 1200+ tech skills courses.