Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you mean runtime output errors and not template syntax errors, you could use a (brittle) set of "expect-got" integration tests. How appropriate this is depends on the complexity of your templates and how dynamic they are. If you just want some simple "smoke" tests, this is probably a good solution.</p> <p>For each template, create at least one test. Using concrete/static/pre-specified input data and concrete/static/pre-specified output results. This output has to be manually generated and verified the first time after any change, but from then on it can be saved and testing can be scripted. If the template pulls in its own data (like dates, etc) that can't be set as fixed input, mask or remove this from the expected output. Each automated test should:</p> <ol> <li>Generate "got" output from at least one set of input data for each template.</li> <li>Mask or remove unpredictable variable regions from the output.</li> <li>Compare this "got" result to the saved, pre-verified "expected" output.</li> <li>Report failures when these are not the same.</li> </ol> <p>Exact output equality is the easiest to implement and ensure are correct. If needed, have multiple tests per template. I wouldn't try to be clever, just let the computer do boring and repetative work. I would ignore the parts of the template that need to be masked on a first pass (some testing is better then none). Write explicit tests just for them later when you decide it improves reliability enough to be worth the effort (or for any that have been done wrong in the past.)</p> <p>This solutions has the following caveats.</p> <ol> <li><p>The scope is too large. Any change to anything in the template or in the data model can require updating the test. Using "diff" might help with manual verification and determining how to modify tests when data models and/or templates change.</p></li> <li><p>Code refuse and modularity causes testing problems. With good, modular code, one code change can affect data in all templates, but static test require changing and reverifying all the tests independently when this happens. Not much to be done to fix that, so the better and more modular your code, the more work this causes :(</p></li> <li><p>Sophisticated templates are hard to test. It might be problematic to have good template coverage using only a few sets of static data. That could mean the templates are doing too much "processing" and are not really being used just as template. That is probably not a good idea anyway.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload