Wikipedia:Lua unit testing
This is an essay. It contains the advice or opinions of one or more Wikipedia contributors. This page is not an encyclopedia article, nor is it one of Wikipedia's policies or guidelines, as it has not been thoroughly vetted by the community. Some essays represent widespread norms; others only represent minority viewpoints. |
This essay describes issues about testing units of
Overview of integration and unit testing
There are related issues of "
Tactics for unit-tests: Now, back to unit testing, there is a tactic of self-testing in units, such as a
Reporting results from units: Now, major problems are typically found by 2 aspects: data values, and logical control flow (in execution through multiple units). To handle the potential complexity, during operations, each unit can issue "trace statements" which indicate logical flow, from unit to unit, and also show the values of variables along the way, in case they are accidentally clobbered, such as by misusing one variable to store results intended for another variable. The traced information is often written into a huge "log file" (or set of them) because there are often too many details changing to view live, on-screen, so the log file will be re-examined at the end of an extensive run. In some cases, operational errors, as triggered by rare combinations of parameters, will be detected in log files collected for days, or weeks, before the unusual combination recurs, and the details are logged into a file.
Error detection and reporting in units: Overall, each unit, in unit testing, should be checked to ensure proper logging of its data into the log file (often as an article's edit-preview page) or maintenance categories, or writing the debug trace statements, as nothing is worse than logging the wrong data into a multi-day file, only to be misled (or delayed) by errors in error reporting. The emphasis on "test each unit" before integration testing, is part of "
See also
- wp:Lua – overview of Lua usage in Wikipedia
- debugproblems in Lua script
- wp:Lua requests– list of requests/discussion about Lua tasks