How to run Yeti with QUnit testing

November 28, 2012

QUnit is a JavaScript Unit Testing framework by jQuery project. I would like to introduce to the way to run Yeti with QUnit testing since latest Yeti Supporting QUnit test cases.

At first, setup minimum QUnit test case.

<!DOCTYPE html>
  <meta charset="utf-8">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="/resources/qunit.css">
  <div id="qunit"></div>
  <script src="/resources/qunit.js"></script>
  <script src="/resources/tests.js"></script>

And, create test.js just like this.

test( "hello test", function() {
  ok( 1 == "1", "Passed!" );

Install Yeti via npm command.

$ npm install -g yeti

Start Yeti as server mode. Yeti Hub waits to execute testing.

$ yeti -s
Yeti Hub started. LAN:
                  Local: http://localhost:9000

And, open the http://localhost:9000/ in some web browsers that you like. Next open new Shell and run test via Yeti command.

$ yeti tests.html
  Agent connected: Chrome (23.0.1271.91) / Mac OS
✓ Testing started on Chrome (23.0.1271.91) / Mac OS
✓ Agent completed: Chrome (23.0.1271.91) / Mac OS
✓ 1 tests passed! (0.21 seconds)

That’s all. If there is some browsers you want to test, you simply open the Yeti Hub URL. You can be a very large number of tests on actual browsers via one command. And Yeti also supports more other testing frameworks such as Mocha, Jasmine, YUI Test.

Yeti is a open source project that has very active releases, please check it.