Skip to content

Testing

George edited this page May 4, 2017 · 9 revisions

Running Tests

$ npm install 
$ npm run build-ts
$ npm test

Thoughts on testing:

I found it quite difficult to write tests for a project like this. Most, if not all, testing frameworks are not designed for testing webGL/Asm.js. Due to this my test coverage is quite low, I could really only use it on items which didn't manipulate the GUI directly or interact with any of the Emscripten generated code. I did although use TDD(Test Driven Development) to create the undo class and think it helped for a much more robust way to write code.

Improving testing:

These are some things I would consider if I were to try and improve the testing of this project.

  • Investigate using headless browsers for better testing, as I'm aware most do not support webGL etc. Chrome is releasing a headless version that may be able to be used in the future.

  • If it was possible to test the webGL code, I could look into testing the shaders by using a pre-determined texture as the input and then using gl.ReadPixels to test each pixel for its computed value, comparing this to a result calculated by myself.

  • Unit tests could be written for the C++ code. I considered this but decided that it wouldn't be the most worthwhile use, because it would not be able to catch any issues that could appear after its conversion to javascript.

Clone this wiki locally