Chapter 10

Why is it important to find defects as quickly as possible?

Issues are fixed more easily and quickly when they are detected early. The cost of fixing an issue increases exponentially with the time elapsed since the associated code was written. So, finding defects as soon as possible makes the code more stable, faster, and cheaper than when they are detected late in the software development process.

What are the different kinds of software testing?

There are three big categories of software testing:

  • Unit tests, which test functions
  • Integration tests, which test the integration with dependent components
  • System tests, which are end-to-end tests of the entire application

What is a test case in unit testing?

A test case is a group of tests. A test case allows us to group all tests of the same feature.

Why should tests be written before the actual code?

Writing tests before the code they test allows us to check that the test really fails when the feature is buggy. When tests are written after the code, they tend to be less complete. There are even cases where unit tests written after the code do not fail when the tested feature does not work!

Why should logging be done on dedicated observables?

Implementing logging as a specific feature, with a dedicated path in the observable graph, has several benefits:

  • The logging information is independent from the feature provided by the component/driver.
  • The logging feature is completely disabled if nobody subscribes to this observable.

Logging is a side-effect. Is this true or false?

In the example provided in this chapter, logging is a side-effect because the logs are printed on the console. However, another possible design is to write a logging handler that outputs the logs to another observable. This observable would then be routed to a console driver, or a file driver. In this case, the logging feature becomes pure code, and the side-effect is limited to the storing part of the logs.

Which operator can be used to add some traces in a chain of operator?

The do_action operator can be used to perform any action when events are received on an observable, independently of the chain of operators.

What are the two ways to enable the debug mode of AsyncIO?

The first way is to enable it per loop:

loop.set_debug(True)

The second way is to start the Python interpreter with an environment variable being set:

(venv-rx) $ PYTHONASYNCIODEBUG=1 python3
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.4.191