I have a web application that uses the d3 library for some complex SVG based visualizations.
I have automated tests for my server side code and JavaScript models (I use an MVC like architecture in my JavaScript). These are run on a Jenkins CI server on every commit. Now I need to work out how to test my views.
How do others tackle this problem and what tools do you use?
Some thoughts I've had ...
Thanks!
The example you give are for testing the graphical output. For this you can use a screenshot diff tool like PhantomCSS, Sikuli or roll-up your own with Resemble.js.
But if your question is more genrally about testing D3.js/SVG-based apps, as the title implies, you should look at the D3 test suite. Most tests don't even need an html fixture because they are basically testing the API. If the most important thing for you is the consistency of the visual result, go with a screenshot diff tool. For navigation and UX flow, you are better with browser automation like Selenium. But for unit testing, where you want to ensure having a consistent API and modular code, most test frameworks with spies, fixture and mocking capabilities will do (i.e, Jasmine, Vows, Mocha).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With