TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Zombie.js: insanely fast, full-stack, headless testing

74 pointsby tswicegoodover 14 years ago

8 comments

crobyover 14 years ago
First, great work on this implementation. I can't imagine all the work that must have gone into this.<p>To me, this seems to only solve a corner case in the main problem of JS testing - testing the DOM without a browser. The first question that comes to mind is, is a DOM even useful in a headless browser when it comes to JS? For now, grant that we're only testing presence and manipulation of DOM elements and no CSS manipulations or accuracy -- which I'd argue is a decent case for testing. Now, testing presence and manipulation of DOM elements in the abstract isn't very useful, as different browsers might treat DOM manipulations differently. Using a headless browser that no one actually uses doesn't solve this problem.<p>I'd see a case for this in running something like QUnit[1] test that just test JS completeness, but again, implementations differ so testing in one environment that no one actually is using isn't good enough.<p>The only thing that I've come up with for a solution for actually testing JavaScript in a robust, real-world way is using QUnit and Selenium[2] to define the tests, with Testswarm[3] actually running the tests. This setup allows unit tests to be run against JS by itself (QUnir), mock interactions to take place to ensure bindings work properly (Selenium), and have these executed against real browsers in a distributed manner (Testswarm).<p>I concede that this isn't an ideal solution, and I wish there were more people working on solutions like Zombie.js that would combine all of these in one so that JS could finally be apart of our continuous integration testing. The only (sic) thing preventing this solution is that it needs to have headless, identical implementations of all the browser's JS engines and DOM parsers in order to be valid.<p>[1] <a href="http://docs.jquery.com/Qunit" rel="nofollow">http://docs.jquery.com/Qunit</a> [2] <a href="http://seleniumhq.org/" rel="nofollow">http://seleniumhq.org/</a> [3] <a href="https://github.com/jeresig/testswarm/wiki" rel="nofollow">https://github.com/jeresig/testswarm/wiki</a>
评论 #2056572 未加载
评论 #2081379 未加载
hammerdrover 14 years ago
Reliable headless DOM implementations are one of major obstacles for JS as a first class language. Kudos and thanks to everyone that is working to solve this!
wildmXranatover 14 years ago
Does this load external styles, or javascript files? What about the images and does it evaluate any script tags?<p>I have done a few albeit scattered attempts at headless or semi-headless html/js unit tests. What I found out to be a good middle ground is running is this:<p>Run selenium server and firefox on a remote server. Trigger tests via a task queue, which at the moment is Gearman, have firefox draw to a virtual frame buffer.<p>What that does for me is cover pretty much every case that a real browser does, and completeness is key in my point of view. I would like to see how Zombie compares on the completeness side and then speed.
gojomoover 14 years ago
Any chance this could run in Rhino or does the node.js dependency demand V8?<p>Feature for feature, how does this compare to HTMLUnit?
pierrefarover 14 years ago
As I understand it, the JS DOM implementation does not have the quirks of the different browsers. So theoretically, you could write a test that passes and works in browser X but does not work in browser Y.<p>My understanding is that jQuery spends most of its time dealing with these quirks.
arnorhsover 14 years ago
I like the cleanliness of not needing a browser.<p>But it seems like you'll have to duplicate a lot of functionality and as soon as there are a couple of things you can't test against or that don't produce the exact same result then this becomes unreliable.<p>Am I wrong?
评论 #2056684 未加载
bokchoiover 14 years ago
How does this compare to env.js?<p><a href="http://www.envjs.com/" rel="nofollow">http://www.envjs.com/</a>
EGregover 14 years ago
does this thing actually compute the rendered coordinates properly, as a browser would? Can I load jquery and call offset() ?
评论 #2056199 未加载
评论 #2056103 未加载