/jq-test-template

Project template for JavaScript testing using jQuery and QUnit

Primary LanguageJavaScript

jq-test-template

Just a project template for testing JavaScript apps. It already includes jQuery, since it's my JS framework of choice, most of the time.

Hint: if you run it in the Chrome browser, you get a cool notification window for the tests results! ;-) But beware, you must run the test in a server (e.g. a local server) for the notifications to work.

Structure

The project follows this basic file structure to start with:

  • src/ - directory for source files
  • src/core.js - core library script
  • test/ - directory for automated tests
  • test/qunit.css - QUnit stylesheet; not recommended to be changed
  • test/qunit.js - QUnit library; not recommended to be changed
  • test/tests.html - run this in a browser to run the tests. It already contains the UI for the tests results
  • test/tests.js - put your test cases here. It already contains some demo tests, but they're by no means necessary
  • vendor/ - put your library files here. Recommended to keep each in a separate subdirectory
  • vendor/jquery/jquery-x.min.js - minified version of the (hopefully) latest version of jQuery

Why jQuery?

Boy, I really love jQuery, that's why! But I like other frameworks a lot, too, like Prototype, YUI, dojo etc. If you want to rip of jQuery it's easy: just remove it from the "tests.html" file, and provide another way (other than "$(document).ready()") to launch the tests, like using window.addEventListener('load', function(){ "tests here using standards-friendly browsers"; }) or window.attachEvent('onload', function(){ "tests here using old Internet Explorer versions"; }) or any helper that abstracts the functionality above.

License

Since this project does not provide any production code - it's just a skelleton for new projects -, there's no need to attach it to any license. Just keep in mind to use licenses compatible to the libraries used here (like QUnit and jQuery). As for the icons, they're from the free Phoenity Alpha icon pack (can't find the link to it right now).