Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless unit testing framework. #17

Closed
mbostock opened this issue Oct 25, 2010 · 3 comments
Closed

Headless unit testing framework. #17

mbostock opened this issue Oct 25, 2010 · 3 comments
Labels
bug Something isn’t working

Comments

@mbostock
Copy link
Member

We should use env.js, now that 1.3 supports Node.

@jasondavies
Copy link
Contributor

Have you come across TestSwarm? (testswarm.com appears to be down, but you can read about it at https://github.com/jeresig/testswarm/wiki). Their opinion on headless testing:

A popular alternative to the process of launching browsers and running test suites is that of running tests in headless instances of browsers (or in browser simulations, like in Rhino). All of these suffer from a critical problem: At a fundamental level you are no longer running tests in an actual browser – and the results can no longer be guaranteed to be identical to an actual browser. Unfortunately nothing can truly replace the experience of running actual code in a real browser.

Now, TestSwarm does seem a bit Alpha (especially since the main site doesn't seem to be loading!) but it could be good if universal browser support is a priority (maybe it's not?)

The other thing to mention is the QUnit unit testing framework, which is quite nice. It's used by underscore.js - see the test/ directory. I set up some tests of my own using theirs as a starting point and it seemed very straightforward.

@mbostock
Copy link
Member Author

My main requirement is minimal overhead during the development cycle; I should be able to run the unit tests quickly on the command line as part of the make process, so that I can run them continuously as I'm developing. The tests must be fast.

It seems reasonable to also have more comprehensive, distributed, asynchronous tests, outside the development cycle. With these you are notified later when tests fail. I put TestSwarm in that category. It'd be nice to have, but I'd prefer it in addition to the simpler headless tests.

jQuery is heavily focused on providing compatibility across browsers. D3 is not a compatibility layer. Yes, I'd like it to have universal browser support, but having tests for a single environment (such as Node/V8) would give us at least 90% of the value from testing. I'd rather have D3 focus on using the W3C standard APIs, a forward-looking approach, then get burdened with all this cross-browser nonsense. The main goal here is to support rich, interactive visualization in SVG and that's going to require a fast, modern browser regardless!

@mbostock
Copy link
Member Author

mbostock commented Mar 5, 2011

Implemented a simple testing framework using Node & env-js. I'm tempted to look at Zombie.js, though, since I had to excise large chunks of env-js to get it to play nice. Good news is that the tests have already uncovered a few small bugs in d3.format and Sizzle integration. :) Hooray!

murtada58 pushed a commit to murtada58/d3 that referenced this issue Mar 16, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Development

No branches or pull requests

2 participants