-
Book Overview & Buying
-
Table Of Contents
Python Automation Cookbook - Third Edition
By :
Tests are typically prepared in batches. Similar tests require a similar setup and cleanup, and they only differ on small details. Repeating the same preparation over and over generates boilerplate code and is less readable.
The term boilerplate comes from 19th-century local newspapers printing already-prepared news stamped onto metal plates by distribution companies. This meant the same news, in the same format, was repeated all across different newspapers. Boilerplate code is reused code that presents little or no variation and, in most cases, mainly adds clutter. When creating tests, it is easy to fall into this pattern, which makes the code cumbersome.
At the moment, a common trap is to repeat the code quickly through the usage of GenAI tools, which will produce boilerplate and won't get tired of adding it over and over. While this is good from the point of view of generation, it makes the tests more difficult to read and to understand. Easily understandable...