Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

http://phantomjs.org/

http://jasmine.github.io/

Not trying to snark, but if you need to test javascript, use jasmine. If you want to acceptance/integration testing (depending on your definition of those terms) as a user clicking around your site to make sure the things you think happen are actually happening, use phantomjs (I'd also suggest using nightmarejs on top)



Phantom is unreliable, barely maintained, and brutally slow. I think one of the reasons Angular has seen such remarkable adoption is because it made testing easy, quick, and idiomatic.


A little more detail please?

Unreliable

What version of phantom are you referring to? Do you have any specific examples?

Barely maintained

They do have a lot of tickets open, but in uses of phantom (wrapped by nightmarejs), I have not run into many issues that even required filing tickets/requiring maintenance. 90% of the use case of something like phantom is rolling around the page and clicking on stuff/filling out fields/evaluating some javascript, and it does that fantastically most of the time. Maybe I haven't done enough ambitious things with phantom.

Brutally slow

Compared to what? Selenium? I hope you're not comparing to the testing included with angular, because those are two different kinds of tests. Also, in the end, I think the most important kind of test is the kind of test you write with something like phantom/selenium because it requires that the system (at a macro level) does what it's supposed to do. If you make a todo app, you can have all your unit tests pass and the app still be broken. You definitely can't have your integration/end-to-end test pass if the app doesn't actually work (though the functions may be terrible, buggy, etc.

Personally (I have no data to back this), but I doubt Angular has seen remarkable adoption because of easy testing.

[EDIT] - I just noticed that you ignored the mention of Jasmine -- Maybe Angular shouldn't require it's own testing strategy at all, that seems like a pretty good indicator of a monolith (which Angular is, so I guess that's not really an interesting point).


Most recently, this forced me to upgrade: https://github.com/Medium/phantomjs/issues/161 And that forced upgrade broke the cookie mock/stub code that we wrote. It took almost a day of thrashing to fix the failures, none of which could be seen in a real browser. Super irritating.

I've also had to work around weird JS issues that only affect Phantom, and corrupted screenshots making it rather hard to see what's going wrong. For our team's time-spent vs time-saved, Phantom has been a waste. Our app is very JS-heavy, but that's why I thought Phantom would be a good idea.

I think the most important kind of test is the kind that developers will actually use. If tests are hard to understand, hard to run, unreliable, or slow, then they won't get used (Selenium!).

I just want idiomatic, quick, easy-to-write tests so regressions in our app are much less likely to happen. Angular's approach met those requirements pretty well and that was a big influence to our choice to use it (two years ago, data point of one). It looks like React has a good approach to testing too.

If the Aurelia docs suggest using Jasmine to test the application, especially if they help setting up html fixtures and data, then that's encouraging. But I don't think they do. For now it's all DIY so, if I join your Aurelia team, I have to spend a bunch of time learning how your testing works? In my experience, that means your project will most likely have very little testing.


all good points -- will take this in mind when recommending phantom in the future. While I haven't run into the same # of issues, but I can absolutely see why you guys didn't like it, and the possible issues I could run into some day using it.

Also agree with writing tests that devs will actually run, though I think that is going away with the advancements in orchestration/devops. If buildbot or jenkins can run the tests then you may not have to rely on a human's willingness to run it. Speed's another matter though.

Oh and no, they don't suggest using Jasmine to set up the application (not that I read) -- that was just my assumption (that you could). And that's a very good point, if they don't pay attention to testing (and make it very obvious/easy), then it will fall by the wayside.


Often tests fails in Chrome/Safari when passes in PhantomJS (and after that I can't trust PhantomJS anymore). Often PhantomJS is far behind modern frameworks in features. It's from my experience. And Angular can be tested not only with Jasmine - use Mocha or something else, if you like.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: