Changes for page Tips and Tricks

Last modified by chrisby on 2024/04/01 13:11

From version 1.20
edited by chrisby
on 2023/06/03 18:24
Change comment: There is no comment for this version
To version 1.21
edited by chrisby
on 2023/06/03 18:25
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -58,5 +58,5 @@
58 58  * **Test Case Logging**: If certain production code needs to be called several times with slightly different arguments, it may be useful to iterate over a list of these arguments, calling the production code and then asserting the result on each iteration. It is then often good practice to print out each element before each assertion. If an element causes a test to fail, the terminal output will immediately show which element caused the error.
59 59  * **Bug Coverage Responsibility**: If you find a bug or a case that has not yet been tested, it is your duty to create a test that covers it, so that the software is stable against that problem from that moment on.
60 60  * **Range-Based Assertions**: Inaccurate results should never be asserted against an exact value, but only within an expected range of approximation. This includes all assertions of floating-point numbers.
61 -* **Avoid Cascading Validation**: It would be very cumbersome to perform input validations, such as the famous null checks, and corresponding tests for each unit. A common solution is to define a module consisting of several classes. The class at the top, which receives the input for the first time, validates it once. All subsequent classes can safely assume that the input is not null when processing it, and no longer need to explicitly check or write tests for such cases.
61 +* **Avoid Cascading Validation**: It would be very cumbersome to perform input validations, such as the famous null checks, and corresponding tests for each unit. A common solution is to define a module consisting of several units. The unit at the top, which receives the input for the first time, validates it once. All subsequent units can safely assume that the input is not null when processing it, and no longer need to explicitly check or write tests for such cases.
62 62  * **Stick to Performance Requirements**: Once a performance test is passed, there is no need to optimize the performance of the code. Any effort in that direction is a waste of resources.