DailyJS survey from December 2012:
Set up a page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My QUnit Test</title>
<link rel="stylesheet" href="/resources/qunit.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="/resources/qunit.js"></script>
<script src="/resources/underscore.js"></script>
<script src="tests.js"></script>
</body>
</html>
And in tests.js:
module("My Underscore Test");
test("values", function() {
equal(_.values({one: 1, two: 2}).join(', '), '1, 2',
'can extract the values from an object');
equal(_.values({one: 1, two: 2, length: 3}).join(', '),
'1, 2, 3', '... even when one of them is "length"');
});
Adam Hawkins at RejectJS 2012 (watch)
Open the test page URL in the target browser(s)
Automate with Launchpad:
Automated cross-browser test reporter for QUnit, Jasmine and Mocha
Some neat features:
Install:
npm install -g testee
Go to your project folder:
cd underscore
Point to your test page and run with PhantomJS:
testee test/index.html
Point to your test page and run with local Firefox:
testee test/index.html --browser firefox
Output XML test results for CI:
testee test/index.html --browser safari --reporter XUnit > testresults.xml
Run tests on Chrome Canary and output code coverage statistics:
testee test/index.html --browser canary --coverage
Test with IE 9.0 on BrowserStack:
testee test/index.html --browser ie:9.0@win --launch browserstack
Set up Remote Preview to open tests on other devices:
{
"tunnel": {
"type": "local",
"hostname": "airblubber"
},
"launch": "remotePreview",
"browser": {
"file": "remote-preview/url.txt"
}
}
And run like:
testee --config testee.json
Automated tests performed from a user perspective
Used for
Functional testing library built on top of jQuery and QUnit:
Testing a TodoMVC app
test('TodoMVC app', function() {
S('#new-todo').click().type('Do some nerdy stuff\r').wait(500);
S('#todo-list li').size(1, 'Got one Todo');
S('#todo-list li:first label')
.html('Do some nerdy stuff', 'Todo has correct text');
S('#todo-count').html(/<strong>1<\/strong>(.*)item(.*)left/,
'Todo count text is correct');
});
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |