Having worked with both, I'd like to put in a vote for Jasmine over QUnit. Unit test is a Java construct which can feel out of place in Python, never mind JS. I find QUnit clunky and difficult to write, whereas jasmine (as a behavioural tool) is pleasant to write and likely comes closer to the kind of tests we would run - checking user interactions with the admin do the correct thing.
As an aside, there may be a way of avoiding the NodeJS problem for devs - I think a static HTML file which includes all the jasmine test files (or QUnit) would work in any (good) browser for local manual testing. We would then either use Phantom for Jenkins, or in theory we could open that aforementioned file using Selenium and check it runs all the JS tests properly. This is probably vile though. The absolute best solution is to use Jasmine in browser opened via selenium or similar but report back individual test results via a socket to a custom python unit test reporter - reporting each JS test with details to the console as it if were a Python test. This is effectively what karma.js does from what I remember. This would not only be great for our test suite, but allow easily writing front end tests for any Django application. Several projects I have worked on has two completely distinct test suites one for JS and one for python. Being able to run both together must be better - and may also allow use of LiveServer like functionality within your JS (leaky) "unit" tests. Marc On 18 Apr 2014 22:10, "Trey Hunner" <[email protected]> wrote: > > On 04/16/2014 07:20 PM, Russell Keith-Magee wrote: > > > > 2) Is there anything that can save us from the Node.js kudzu? :-) > > Yes. Removing JavaScript from Django. :-) > > JSHint requires Node.js and running automated JavaScript tests > typically requires Node.js and PhantomJS. > > Node.js is pretty easy to install and it would only be required for > JavaScript linting and automated testing. You wouldn't necessarily > need Node.js to manually run the tests locally in a browser, but you > would need it for running tests from the command line. > > > > You've definitely identified that this is a long term project; so if you > > can lay out a map for the way forward, with an indication of the end > > goal, that would be a fantastic start IMHO. > > Agreed. I will try formulating a more concrete proposal. I work > full-stack but I have limited experience with JavaScript testing > frameworks, so my personal preferences include a sample size of one. > I will try to keep my suggestions to the community standards as I > perceive them. > > > On Thu, Apr 17, 2014 at 10:30 AM, Carl Meyer <[email protected]> wrote: > > > > A DEP might be a good format to summarize the thinking that goes into > > picking a particular tech stack for JS tests. > > I will look at the DEPs and try to propose a concrete example there. > > > > (FWIW, on my company's projects we unit-test JS using Node, PhantomJS, > > Grunt, QUnit, and Istanbul for test coverage measurement, so that's the > > stack I'm familiar with. It's worked very well for us; there's a > > grunt-qunit-istanbul plugin that brings the pieces together nicely. But > > I didn't make those choices and am not familiar with the alternatives; > > there may be better options.) > > I have a very similar setup. I chose qunit because it seemed popular > among front-end JavaScript projects and because jQuery uses it. > > QUnit and Jasmine seem like the winners in this space at the moment. > > We may also want to consider looking at the Karma test runner by the > Angular.js team (it supports a number of test frameworks including > QUnit and Jasmine). I know little about it, so feedback on this would > be helpful. This may be something that can be added later. > > I analyzed the test runners used by the top 12 front-end JavaScript > libraries on Github (according to the API). Here are the numbers: > > QUnit test framework is used by: > - Backbone > - Ember.js > - Knockout > - Reveal.js > - jQuery > - three.js > - jQuery-File-Upload > > Jasmine test framework is used by: > - Knockout > - Spine > - Brackets > - Angular.js (using Karma) > > Vows test framework is used by: > - d3 > > I'll start working on that DEP. > > -- > Trey Hunner > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/CACuWcAxsRN6YwSM5GfA42TEgMv3cWeJ27L3gW5Yh%2Bpm5ASwMag%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMwjO1HWz19hSHb_OoFQP%3D4fN3Ogq%3Dxd4ZqKKw-0Jobs8SmXHg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
