Developing a program to test

This page discusses - Developing a program to test

Developing a program to test


Developing a program to test

Given below program is to test the script :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<script src="">
<link rel="stylesheet" href="
/raw/master/qunit/qunit.css" type="text/css" media="screen"/>
<script type="text/javascript" src="


test("a basic test example", function() {
ok( true, "this test is fine" );
var value = "hello";
equals( "hello", value, "We expect value to be hello" );

module("Module A");

test("first test within module", function() {
ok( true, "all pass" );

test("second test within module", function() {
ok( true, "all pass" );

module("Module B");

test("some other test", function() {
equals( true, false, "failing test" );
equals( true, true, "passing test" );


<h1 id="qunit-header">QUnit example</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>

Description of the program :

For explanation of QUnit methods click here.

Description of the CSS class used in html tags :

The #qunit-header element should contain the name of the testsuite, and won't be modified by QUnit. The #qunit-banner element will set to show up as red if a test failed, green if all tests passed. The #qunit-userAgent elements is set to display the navigator.userAgent property. The #qunit-tests element will be used as a container for the test results.

The #qunit-fixture element can be used to provide and manipulate test markup, and will be automatically reset after each test.

Output :

Download Source Code

Click here to see online demo

Learn from experts! Attend jQuery Training classes.

Share on Google+Share on Google+

Developing a program to test

Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Developing a program to test  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image