[GSoC Proposal] JavaScript testing framework

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
cwgordon7's picture

Overview: I would like to write a full-fledged JavaScript testing framework for Drupal. As Drupal has grown, it has incorporated more and more JavaScript into its user interface, so being able to test JavaScript is critical in ensuring that the user interface is functional. A JavaScript testing framework could be used for unit tests, such as for API functions like Drupal.checkPlain(), as well as for logical functional tests of complex user interface pieces, such as tabledrag.

Description: I would like to use the QUnit testing framework as a stable, well-supported jQuery-based JavaScript testing framework. I wrote a contributed module for QUnit using Drupal several years ago, but this was for Drupal 6, and QUnit has matured a lot over the past few years. I would start by porting the QUnit module to Drupal 7 and Drupal 8 (tracking HEAD), and updating the version of QUnit used in the module. I would then flesh out the functional testing framework - I played around with an iframe-based approach that looks promising for functional tests. Integration with Drupal's server-side testing framework (simpletest) may be necessary for some functional tests, so doing that as early as possible is a high priority.

Once the system is working, I would like to write as many unit tests and functional tests as I can, to flesh out use cases for the framework, and make sure to fix any part of the system that needs work. This will provide a strong base of tests for the framework. I may very well find some bugs in Drupal's JavaScript in the process; I'll make sure to file bug reports (perhaps with patches) for any bugs that I find.

Other things I may do towards the end of the summer, if people think there will be enough time for all of this: work on a patch for incorporating this into Drupal core, and/or work out the details of distributed cross-browser JavaScript testing.

Schedule:

  • By May 29th - have module ported to Drupal 7 / 8, with most up to date version of QUnit.
  • By June 12th - have both functional and unit testing working, with at least one test of each type.
  • By June 26th - functional testing incorporation with SimpleTest should be completed, with more tests of each type.
  • By July 10th - write tests for most, if not all, large JavaScript components in Drupal core.
  • July 11th - midterms
  • By July 24th - polish contributed module and prepare a core patch.
  • By August 7th - continue iterating on core patch, perhaps some work on integration with qa.drupal.org / distributed cross-browser testing.
  • By August 21st - wrap up work, bug fixing, etc. It would be great to have a core patch committed during this time frame.

Mentors: Katherine Senzee (ksenzee) mentioned on IRC that she could mentor this.

Who: I am Charlie Gordon, a first-year student at MIT majoring in Computer Science & Engineering. I've been contributing to the Drupal project since the GHOP contest in 2007. My contributions include work on 68 patches that were incorporated into Drupal 7 core, as well as the author and maintainer of several contributed modules. The details of my Drupal contributions are list on my drupal.org profile. Some of my contributions that are relative to this project; I helped incorporate SimpleTest into Drupal core, I helped program the JavaScript-heavy Drupal 7 administrative overlay, and I played around with using QUnit as a jQuery-based JavaScript testing framework for Drupal 6 a few years ago, culminating in the contributed QUnit module.

I'd look forward to feedback on this proposal, since this is my first draft of it. Thanks!

Comments

Looks awesome

dmitrig01's picture

Charlie, this looks great. Go for it!

looks great

ksenzee's picture

Goals and timeline look great to me, and yes, I'm very happy to mentor. Can't wait to see it happen. :)

I think this is great too. I

clemens.tolboom's picture

I think this is great too.

I just learned from using qunit within http://drupal.org/sandbox/clemenstolboom/1125712 (an issue branch for Dreditor)

I'm happy to help this forward. :)

I'm a little puzzled how a setup looks like for automated browser testing. I do user ran tests :(