It is difficult to write certain unit tests for something visual like this unless you really understand the exact sequence of API calls that will be created.
To check for something โvisualโ like this, you have three parts.
"Spike" to get the right look, scale, color and all that. In some cases, this is almost the entire application.
In a โmanualโ test, this creates some final images to make sure they look right for someone. There is no easy way to verify this, except to actually view the actual output. It is hard to automate.
Discard the graphic components to make sure your application names the graphic components correctly.
When you make changes, you need to run both tests: does the API call correctly? and does this sequence of API calls call an image that looks right?
You can - if you really want to break a brain cell - try creating a PNG file from your graphics and test to see if the PNG file looks right. It is hardly worth the effort.
As you move forward, your requirements may change. In this case, you may have to rewrite the spike first and make things look right. You can then infer the sequence of API calls to create automatic unit tests from the surge.
It can be argued that creating a burst violates TDD. However, the spike is designed to create a test graphics module. You cannot easily write test cases, because the test procedure "will show it to a person." It cannot be automated.
source share