boxes icon indicating copy to clipboard operation
boxes copied to clipboard

[WIP] Add smoke test

Open Rotzbua opened this issue 2 years ago • 3 comments

Since I made some changes to the code and was never 100% sure that they didn't change something unexpected I thought it would be useful to add tests.

Procedure

The simplest solution for me was a smoketest. The simple idea: a currently generated box file must match an earlier one.

As a reference the example files are used and compared with the current software version generated example files. If there is a difference then the test fails.

Disadvantage

If changes are made that permanently change the output, new sample files must be included in the repository as a reference.

Rotzbua avatar Jan 17 '23 14:01 Rotzbua

Hello :-)

I thought too about something like this when contributing some boxes 🎉 In some cases, I find the approval testing or golden testing approach can be usefull. What would help have a more smooth developer experience might be some script to help validate the new files as the new target reference when the changes are accepted. I never tried it in Python, but there is some testing library geared toward this workflow, I don't know if it could help? For example https://approvaltests.com/ / https://github.com/approvals/approvaltests.Python I wondered if a svg text content comparison would be better, or a bitmap comparison (two different svg can have the same meaning).

Thanks!

gcollic avatar Jan 21 '23 09:01 gcollic

And for the boxes.py library itself, it could be useful to have some documentation about how the primitives works to contribute other boxes, with a sample code shown with its visual result just below, and this documentation could work both as a documentation and a unit test / non-regression test, using an approach similar to approval testing geared toward documentation. I especially love https://sfauvel.github.io/documentationtesting

I have another project (in C#) built like this that I should contribute soon on GitHub if someone want a concrete use case as an example. Not sure how to do this in Python, but I could look if there is an interest. (and if this is the case I will create a different issue / pull request to not pollute this one anymore with this different but related idea ;-) )

gcollic avatar Jan 21 '23 09:01 gcollic

For an example of what unit / non-regression tests oriented toward developper documentation could look like:

gcollic avatar Jan 30 '23 12:01 gcollic

I think a different approach with 'pre-commit' would be better. Closed.

Rotzbua avatar Apr 01 '24 13:04 Rotzbua