Skip to main content

Total Pageviews

Follow the Zeal Study channel on WhatsApp:

Follow the Zeal Study channel on WhatsApp:
Click the image to join our channel

Unit Testing in Python

Overview
Many programmers manually test the code they are writing by calling the piece of code they are developing, printing the result to the console,
and visually scanning the output for correctness. This works for simple tasks but suffers from some problems:

  • When the output gets large, it becomes harder to spot errors.
  • When the programmer tires, it is easy to miss subtly incorrect output.
  • When the implemented feature becomes larger, one tends to miss regressions in parts that were "tested" earlier.
  • Because the informal test scripts are generally only useful for the programmer who wrote them, their utility is lost to other developers.

Thus, unit testing was invented, in which one writes sample calls to pieces of code and compares the return value to the expected value.
This comparison is typically done in a way that produces little or no output when the test passes and very obvious output otherwise. A test
harness can be used to run tests from several test scripts and only report the errors and a statistical summary of the passed tests.

Comments

FOLLOW US ON GOOGLE NEWS BY CLICKING THE IMAGE

Popular posts from this blog