CartoDB / carto-vl

CARTO VL: a Javascript library to create vector-based visualizations
BSD 3-Clause "New" or "Revised" License
129 stars 26 forks source link

Acceptance tests #39

Closed Jesus89 closed 6 years ago

Jesus89 commented 6 years ago

Acceptance tests:

IagoLast commented 6 years ago

Since this domain is hard to test, we must establish a QA process, this involves:

We can also try to automate this process using some screenshot testing utility.

Jesus89 commented 6 years ago

I'm OK with jasmine and karma :rocket:

Jesus89 commented 6 years ago

For the e2e/acceptance testing Exquisite seems to be a good option but I would look for alternatives in order to be sure that there is nothing better.

IagoLast commented 6 years ago

About Acceptance testing:

We agreed on having an examples folder with unitary examples for every use-case and use automated screenshot testing to compare reference images against new taken images.

Problems

I suspect that we are going to need a threshold so high that the tests will become useless and will always pass. Thats my reason for that's the reason why I lean towards option 2.

cc @Jesus89 @davidmanzanares

davidmanzanares commented 6 years ago

I suspect that we are going to need a threshold so high that the tests will become useless and will always pass.

I don't think so.

If I was gonna do this, I would use ImageMagick comparison metrics instead of local references because it's easier to test on new machines and environments.

Since we've extensively discussed this in other channels, I'm not gonna block a PR with the local references approach, but I don't think it's the right approach.

IagoLast commented 6 years ago

@davidmanzanares I think we should run some tests with the threshold approach.

What metrics do you suggest?

davidmanzanares commented 6 years ago

@IagoLast PSNR should work well enough, but ImageMagick has many: https://www.imagemagick.org/script/command-line-options.php#metric

Jesus89 commented 6 years ago

This is partially solved by: https://github.com/CartoDB/renderer-prototype/pull/51.

So let's rename this ticket to "Integration tests"

rochoa commented 6 years ago

Having a threshold is OK. In a 256*256 image, a 0.3% error results in ~200 different pixels. We can live with that margin of error or even higher most of the time.

The tolerance we used for comparing PNG32 and PNG8 images in Windshaft was set to 8.5%. At the time, we used the simple FUZZ metric. You can check the differences in https://github.com/CartoDB/Windshaft/blob/master/test/results/compare.html.

IagoLast commented 6 years ago

Acceptance POC

reference actual result
map1 map2 🎉
map1 map2 🎉
map1 map2 🎉

More complicated example: rampNumericBuckets.html

reference actual result
map1 map2 👎
IagoLast commented 6 years ago
Jesus89 commented 6 years ago

The current metric tool pixelmatch detects the number of different pixels in an image using a threshold by default of 0.1. This threshold is used to compute maxDelta that is the maximum acceptable square distance between two colors. Taking into account that he maximum possible value for the YIQ difference metric is 35215, this is the relation between threshold and maxDelta:

delta-threshold

For each pixel position in both images a delta value (squared YUV distance between colors) is computed. If this value is greater or equal than maxDelta the pixels are different, otherwise they are equal.

Jesus89 commented 6 years ago

Closed by: https://github.com/CartoDB/renderer-prototype/pull/40

rochoa commented 6 years ago

@Jesus89, thanks a lot for sharing those details. BTW, keep your eyes open for the upcoming blog post: https://twitter.com/mourner/status/966098017723076608. 👀