5 ms·
Introducing Google JS Test
- nod 15y agoThis is for unit-testing in V8 only: no DOM. I'm currently using PhantomJS, which is V8 + Webkit and seems to be a superset of this new "JS Test". I can't see any reason to add JS Test in addition to PhantomJS.
- dustmop 15y agoAnother possibility, which I use for testing my Firefox Add-ons, is using Rhino + env.js, which creates a very good simulation of the DOM.
- icefox 15y agoFor several years I have been using QtWebKit to write tests that utilize the dom. Fast startup, console output etc. I wouldn't be surprised if the Chrome guys have a similar stripped down Chrome for JS unit tests.
- cleverjake 15y agonon-dom based javascript, would be my first thought.
- kodablah 15y agoCould be very helpful as a node.js addon
- Volpe 15y agoNot really, node.js already has heaps of testing frameworks that work fine in it.
- barnaby 15y agoI'm looking to branch out after having used qUnit for the last year or so. Looks like this framework does mocking REALLY well (which I feel like I can't do well in qUnit). But it's v8 specific, so I can't test if Internet Exploder won't screw up my script. Would anybody recommend any other unit-test frameworks for mocking stuff out?
- lappet 15y agoYou can look at jasmine + sinon http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with...
- ch0wn 15y agoThere's also a fantastic tool for running those tests headlessly with jasmine-headless-webkit[0]. The benefit is that you can, if you so desire, test against the DOM as there is a complete browser in the background. [0] http://johnbintz.github.com/jasmine-headless-webkit/ http://johnbintz.github.com/jasmine-headless-webkit/
- lappet 15y agoAh, interesting. If headless is not what you want, js-test-driver[1] looks promising. It has adapters for jasmine too. 1. http://code.google.com/p/js-test-driver/ http://code.google.com/p/js-test-driver/
- philjackson 15y agoI've been using jquery in node.js for a while now in my tests. This gives me access to the DOM and all of the great stuff that jQuery gives us: @GET "/", ( err, response ) => response.withJquery ( err, $ ) => @equal $( "#blah" ).text(), "Something" Really cool stuff.
- vailripper 15y agoHave you looked into zombie.js (http://zombie.labnotes.org/ http://zombie.labnotes.org/)? It allows for selectors as well, and is a very straight forward headless browser.
- philjackson 15y agoNo, I hadn't. It looks great, I'll certainly check it out properly soon!
- rchiniquy 15y agoI've been really happy with JazzMoney: https://github.com/pivotalexperimental/jazz_money https://github.com/pivotalexperimental/jazz_money I'm looking over the limited documentation available and so far I'm not persuaded to switch. I'm very curious about measuring code coverage - nothing seems to be mentioned there about it, but I imagine the Goog does do that.
- unit_testing 15y agoWhat's the purpose of complex testing frameworks like this? What's wrong with using a simple framework whose tests must simply return a bool? For example: var myObject = new Something("foo", "bar"); assert("simple operations", function() { return myObject.doSomething() == "baz"; });; assert("post-operational state", function() { return myObject.state() == 123; });; assertAync("async polling", function() { return myObject.poll().length > 0; });; Note that those tests would be much prettier in CoffeeScript. Is the purpose of heavy testing frameworks purely for the useful functions like "deepEquals"? If so, why not make a library with functions like "deepEquals" and use that library with a simple testing framework? Surely, there must be something I'm missing. Edit: I should note that the beautifully written CoffeeScript compiler/translator doesn't use a testing framework (favoring a few simple hand-rolled functions), and it has a massive suite of tests.
- exogen 15y agoOne advantage is debugging failures. If the test framework only knows that a test passed or failed, but not why, then you don't get to know why either, because it can't tell you. For instance, many test runners will show you the expected and actual values when a comparison fails. If they're large blobs of text, it can show you a diff, etc.
- sho_hn 15y agoAnyone recognize the font in the screenshot?
- aiurtourist 15y agoDid anyone else notice the screenshot is of a translucent terminal? I was curious what was in the background so I played with the levels. http://i.imgur.com/6jifV.png http://i.imgur.com/6jifV.png http://i.imgur.com/cIXox.png http://i.imgur.com/cIXox.png
- Garbage 15y agoI would love to hear how did you do that.
- aiurtourist 15y agoIn Photoshop, I opened the image up and first chose Image -> Adjustments -> Replace Color. I shift-clicked (sampled) each color of source code by clicking on a few different pixel of the text. I dragged the Lightness slider to zero to make the source code black thereby "erasing" the source from the window. Next, I opened up Image -> Adjustments -> Levels and dragged the grey (middle) adjustment slider toward the left to lighten the darker areas. Dragging the white (right) slider a little left also helps to reduce the maximum blackness of the image.
- Garbage 15y agoThank you for the explanation. :)
- nathansobo 15y agoJasmine.js FTW.