Changes for page Testing Principles
Last modified by chrisby on 2024/04/01 12:52
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -8,7 +8,7 @@ 8 8 * **Falsifiability** = The ability to fail. 9 9 ** Wrongfully failing tests are easy to detect, because a good developer will pay attention to all failing tests and fix the problems before moving on. 10 10 ** Wrongfully passing tests are hard to detect because everything seems fine, which is why it is so important to focus on preventing them. They do damage by appearing to validate functionality that they do not. Use TDD, and get into the habit of mutating the critical section of production code to trigger the test failure, see [[TDD article>>doc:Tutorials and Guides.Test-Driven Development Workflow with Git.WebHome]]. A test should fail before production code is written. Tests without assertions always pass, which is why the assertion should be the first thing written in a test to prevent forgetting it. 11 -* **Determinism**: Repeated tests should always produce the same result. The success of tests should never depend on anything other than the production code. Avoid sources of randomness that could cause the test to fail onlysomeofthe time. These include random number generators, threads, host-specific infrastructure (operating system, absolute paths, hardware: I/O speed or CPU load), networking over the local network or Internet, time/timestamps, pre-existing values in the database or files on the host system that are not in the source code.11 +* **Determinism**: Repeated tests should always produce the same result. The success of tests should never depend on anything other than the production code. Avoid sources of randomness that could cause the test to fail even though the production code is fine. These include random number generators, threads, host-specific infrastructure (operating system, absolute paths, hardware: I/O speed or CPU load), networking over the local network or Internet (since the network or other hosts may sometimes be down), time/timestamps, pre-existing values in the database or files on the host system that are not in the source code. 12 12 * **Single Action Execution**: The entire setup and testing process should require a single click or shell command. Otherwise, they will not be used regularly, which reduces the quality assurance of the production code. 13 13 * **Independence**: Tests should be independent and not influenced by other tests; the order in which tests are executed should not matter. 14 14 * **Clean Test Code**: Maintain the same high standards for test code as for production code. The only exception is execution speed - tests need to be fast, but not highly optimized.