I love these methods which can be used automatically to test things.
If your data is separated from your template you can check to see if the data is in the output automatically. This is why I enforce a separate JSON file to a html/pdf/email/etc template when I have the choice to make the decision.
For example, if your data is {"name": "Peter Pan"} then you can check that the string "Peter Pan" is in the visible output (eg. by using something like jQuery.fn.text(), OCR, or other method ). Same with rows of tabular data in reports.
Along with validation, it's a fairly nice automated way to test your data is actually being output. No more "Hello {name}}," and such.
Of course, if your template is doing a lot of filtering and formatting(date, number or text formatting), this is not as effective. Because it's transforming the data, so you can't use your input data as your expected data.
Spell checking is another example of a test you can apply without too much extra work.
Comment
I love these methods which can be used automatically to test things.
If your data is separated from your template you can check to see if the data is in the output automatically. This is why I enforce a separate JSON file to a html/pdf/email/etc template when I have the choice to make the decision.
For example, if your data is {"name": "Peter Pan"} then you can check that the string "Peter Pan" is in the visible output (eg. by using something like jQuery.fn.text(), OCR, or other method ). Same with rows of tabular data in reports.
Along with validation, it's a fairly nice automated way to test your data is actually being output. No more "Hello {name}}," and such.
Of course, if your template is doing a lot of filtering and formatting(date, number or text formatting), this is not as effective. Because it's transforming the data, so you can't use your input data as your expected data.
Spell checking is another example of a test you can apply without too much extra work.