UnitTest( unittest.asp )

Output

Testing functions
-----------------
Success: helloWorld() == (string)Hello World
Failure: moron("someValue") != (string)anotherValue. Method returns: (string)someValue

Testing BasicMath.add
---------------------
Success: BasicMath.add(2, 2) == (integer)4
Failure: BasicMath.add(2, 0) != (integer)5. Method returns: (integer)2
Success: BasicMath.add(2008, 1) == (integer)2009
Success: BasicMath.add(1, 2008) == (integer)2009

Sources

/axe-ut/unittest.unit.test.asp

<!--#include virtual="/lib/unit-tests.asp"-->
<!--#include virtual="/lib/axe/classes/Utilities/stringbuilder.asp"-->
<!--#include virtual="/lib/axe/classes/unittest.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
    <head>
        <title>AXE - Unit Test - UnitTest</title>
        <!--// meta tags //-->
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <!--// link tags //-->
        <link rel="stylesheet" type="text/css" media="screen" href="/lib/unit-tests.css" />
    </head>
    <body>
        <div id="container">
            <div id="container-hd">
                <h1>UnitTest( unittest.asp )</h1>
            </div>
            <div id="container-bd">
 
<h2>Output</h2>
<div class="code"><pre><%
 
' --[ Definitions ]-------------------------------------------------------------
 
' NOTE: Usually you will be including the definition from somewhere else.
 
function helloWorld()
    helloWorld = "Hello World"
end function
 
function moron(arg)
    moron = arg
end function
 
class BasicMath
 
    public function add(a, b)
        add = a + b
    end function
 
    public function subtract(a, b)
        subtract = a - b
    end function
 
    public function multiply(a, b)
        multiply = a * b
    end function
 
    public function divide(p, q)
        divide = p / q
    end function
 
end class
 
' --[ Testing ]-----------------------------------------------------------------
 
dim Tester : set Tester = new UnitTest
 
Response.write "Testing functions" & vbNewLine
Response.write "-----------------" & vbNewLine
Response.write Tester.test("helloWorld", null, "Hello World") & vbNewLine
Response.write Tester.test("moron", array("someValue"), "anotherValue") & vbNewLine
 
Response.write vbNewLine
 
Tester.container = "BasicMath"
 
Response.write "Testing BasicMath.add" & vbNewLine
Response.write "---------------------" & vbNewLine
Response.write Tester.test("add", array(2,2), 4) & vbNewLine
Response.write Tester.test("add", array(2,0), 5) & vbNewLine
Response.write Tester.test("add", array(2008,1), 2009) & vbNewLine
Response.write Tester.test("add", array(1,2008), 2009) & vbNewLine
 
set Tester = nothing
 
%></pre></div>
 
            </div>
            <div id="container-ft">
                <h2>Sources</h2>
                <h3><%= Request.ServerVariables("SCRIPT_NAME") %></h3>
                <div class="code"><%= geshify( loadTextFile( Server.mapPath( Request.ServerVariables("SCRIPT_NAME") ) ), "asp" ) %></div>
            </div>
        </div>
        <!--// javascript tags //-->
    </body>
</html>