mrdoob/three.js — pull request #3976 by danielribeiro (2013-10-16 06:54:23+00:00)
Title: added high level tests using resemble.js

Hi,

I've talked to a few people about this, even before this [thread](https://github.com/mrdoob/three.js/pull/3873): actually using the demos to automatically test three.js. I've modified a demo and only did one sample, before making a gigantic pull request with 100+ demos, to see what other people think.

Is this valuable? Would more of this be valuable

Writing robust high level tests is [not super easy](http://xunitpatterns.com/Test%20Smells.html), but they are great at increasing coverage and determining that something went wrong. Unlike unit tests, they are awful at specifying exactly what (specially if you are not running them continuously).

I did have to change some things on the demo to make it testable and repeatable across browsers. Also there is an issue with retina Macs and Firefox (devicePixelRatio is not changable on FF), but I'll not bore you with the details unless you want me to.

A live demo can be found here: http://danielribeiro.github.io/threejs-test/test/unittests_three.html

A failing test is included to show what happens when the scene is not correct.

The screen comparison is done through resemble.js: https://github.com/Huddle/Resemble.js

The whole development process of this can be found here: https://github.com/danielribeiro/threejs-test

Cheers,
- Daniel