This is something of a bluesky, long term request, but can we integrate with PHP unit testing for servers that have v8 installed using v8js and Zombie, or some other headless JS testing environment?

This post on v8js looks interesting: http://css.dzone.com/articles/running-javascript-inside-php
There is some prior art for using QUnit w/ Zombie: https://github.com/bergie/zombie-qunit

Comments

attiks’s picture

Rob Loach pointed me to this from #237566: Automated JavaScript unit testing framework, we created TestSwarm to test javascript in real browsers. I like the idea of headless, server based testing, something like Selenium can do as well, it makes it really easy to integrate inside SimpleTest and CI, but it can IMHO not replace real browser testing.

To conclude, I think there's place for both testing approaches and we might need them both for Drupal core.

ethanw’s picture

Thanks for bringing the other libraries into the mix.

First, re: TestSwarm, I'm curious how well it works for continuous integration testing, as my understanding is that volunteer browsers are required to run the tests. My thought in recommending a server-side js solution for unit testing is that this is a faster-turnaround approach for testing patches to JS code etc. I'd be interested to hear the jQuery folks experience w/ TestSwarm and what we'd need in the Drupal community to make it a viable testing strategy.

Re: Selenium, I would agree that there's likely a place for both JS unit testing and browser/headless functional testing. There may be something of a question of priority: whether we need to take on Functional or Unit testing first, but it might also be component specific. For Backbone, for instance, it makes a lot more sense to use unit tests, since the module doesn't actually produce any testable HTML outside of an application.

So, I suppose we're left with: we're going to need both functional and unit testing, and we need to see if TestSwarm is adequate for continuous integration of Drupal module and core development. Is that fair?

attiks’s picture

@ethanw, yes it relies on the community and our mileage may vary, i asked to owner of http://jquerytesting.pbworks.com to send us some details.

Your conclusion is fair, we probable need both

attiks’s picture

RobLoach’s picture

  • JavaScript unit tests could be sent to SimpleTest via v8. I put together http://drupal.org/project/v8js quickly just as a playground. Doesn't do anything useful at the moment, was just curious to see the PHP extension work in a Drupal module.
  • Browser/user interface testing would require Test Swarm/Selenium

Both would probably be needed.

attiks’s picture

Apparently jQuery switched to using browserstack.org to do most of the testing, because crowd testing wasn't really working for them.