Crown-Commercial-Service / govuk-frontend-jinja

Tools to use the GOV.UK Design System with Python webapps that use Jinja2 and Flask 🐍
MIT License
9 stars 6 forks source link

Restructure tests #27

Closed lfdebrux closed 5 years ago

lfdebrux commented 5 years ago

This is an experiment into reducing the fiddliness and repetition in writing tests for govuk-frontend-jinja.

It might be a failed experiment.

The basic premise is that for each test we should be comparing the output of a template file with the output of Nunjucks from that same template file, so I thought that it would be easier to manage if we had separate files for each test; it does mean a lot of files though...

What are people's thoughts?


The major advantage of this it that enables this PR https://github.com/alphagov/govuk-frontend-jinja/pull/28

risicle commented 5 years ago

so I thought that it would be easier to manage if we had separate files for each test

That's understandable. I can see how this might be a step towards autogenerating the tests from upstream examples.

Will :thinking: about possible downsides though. It does mean that the test body for 90% of the tests is the same two lines, which is a little weird.

lfdebrux commented 5 years ago

Will 🤔 about possible downsides though. It does mean that the test body for 90% of the tests is the same two lines, which is a little weird.

I did look at autogenerating the test body based on the files and pytest hooks, the user experience when tests fail is a little suboptimal though.