4. WHY QUNIT?
1.You could testing in your local without server, environment
setting
2. Special for jQuery, JQuery UI, Jquery Mobile
3. Not only support testing in browser, also support testing in
Rhino or node.js
Tess Hsu 4
8. USAGE
Tess Hsu 8
Your web package
├ src // plugin source, project files, etc (could be diff for you)
├ tests // work on here
│ ├ script
│ │ ├ qunit-2.0.1.js // qunit library js
│ │ ├ formTesing.js //your testing file name
│ │ └ otherTesting.js // if you need other testing in different model
│ ├ formTest.html // our QUnit test specification
│ └ css // your qunit css
│ ├ qunit-2.0.1.css // qunit library css
│
├ Gruntfile.js // add qunit task
├ package.json // to install qunit package
└ ...
9. USAGE
Tess Hsu 9
Start first your formTesting.html
1. Head: Insert quint css
2. Body : Insert first qunit id class to have this first demonstrate qunit test page
3. Body: insert what element you want to test
4. Finally, got to include js file you need to call for those testing method
12. USAGE
Tess Hsu 12
Then let’s start most simple testing js file, here I called my testing file: fromTesting. js
1. Put your testing module name, this is also could be in different testing module
ex: QUnit.module( "Field validator" ) or Qunit. Module(“API tesing”) etc
2. Start your testing functionality code, for example
13. USAGE
Tess Hsu 13
Method to use
There’s reference method like ok(), notOk() || equal(), notEqual() etc
http://api.qunitjs.com/category/assert/