Basics What is code coverage? In the simplest words, code coverage is a measure of exhaustiveness of a test suite. 100% code coverage means that a system is fully tested. Why bother about code coverage in Python? Theoretically, the higher code coverage is, the fewer defects a system has. Of course, tests are not enough […]
Category: testing software

How to patch in Python?
What is (monkey-)patching in Python? (monkey-) patching is a technique for changing code behaviour without altering its source. It is done in runtime, usually by overriding attributes of existing objects. An object can be an instance of some sort, a class or even a module. The technique is most commonly (ab)used for tests when we […]

Beware of chicken testing! (or mocks overuse)
Need for mocking Dealing with problematic dependencies is an indispensable part of software testing. Often, we cannot or do not want to rely on 3rd party service/network communication/hard drive etc., especially in unit-tests. The reasons vary; external dependencies are usually slow, fallible and difficult to put into the expected state before the actual test. Consider […]
How to mock in Python? – (almost) definitive guide
What is a mock? Mock is a category of so-called test doubles – objects that mimic the behaviour of other objects. They are meant to be used in tests to replace real implementation that for some reason cannot be used (.e.g because they cause side effects, like transferring funds or launching nukes). Mocks are used […]
Code review: how experienced developers do it?
High-quality code review is one of the secrets of the most effective teams. Over the years I noticed a few interesting ways to approach it. Now I share them with you in this article. Recipe 1: Suggesting refactoring in the right moment Seemingly nothing spectacular, though I do not mean excessive code polishing just to […]
Is your test suite wasting your time?
This article has been originally included in a PyconPL 2018 conference book. Abstract Nowadays there is no need for convincing anyone about the enormous advantages of writing automated tests for their code. Many developers had an occasion to feel total confidence in introducing changes to their codebases under the protection of vast test suites. The […]
How to automate testing (almost) any app?
Let’s talk about higher level testing – acceptance and end-to-end. Such test suites interact with your application in the same way as ordinary user. Therefore, we require our tests to communicate with application at the same layer. In other words, we should use the same interface whether is it GUI, browser or REST endpoint. Naturally, higher level test suites should consist […]