Can you do a unit test in ASP?

5

I'm in need of an ASP unit test help for a software quality project. Is it possible to do this?

Remembering it's classic ASP.

    
asked by anonymous 18.03.2015 / 15:24

1 answer

6

The classic ASP (Active Server Pages), just to make it clear, is not a programming language, the language is VB or Jscript.

There is a framework called aspunit based on junit , aspunit is a VBScript implementation and requires IIS 5.0 or IIS 5.1.

Download: link (last updated 2004).

  

In the TestASPUnit folder you have a test sample.

Alternatively I also found this link (this is much more updated)

Using

This is a minimal configuration example:

<!-- #include file="/Test/Lib/ASPUnit.asp" -->

Call ASPUnit.AddModule( _
    ASPUnit.CreateModule( _
        "Simple Tests", _
        Array( _
            ASPUnit.CreateTest("TestSomething"), _
            ASPUnit.CreateTest("TestSomethingElse") _
        ), _
        ASPUnit.CreateLifeCycle("Setup", "Teardown") _
    ) _
)

Call ASPUnit.Run()

Sub Setup() ' Could do something here
End Sub

Sub Teardown() ' Then undo it here
End Sub

Function TestSomething()
    Call ASPUnit.Ok(True, "This assertion should pass")
End Function

Function TestSomethingElse()
    Call ASPUnit.Ok(False, "This assertion should fail")
End Function
  • Assertions

    • Ok(value, description) : Tests whether the value is True
    • Equal(actual, expected, description) : Tests whether the value is the same as expected
    • NotEqual(actual, expected, description) : Tests whether the value is different than expected
    • Same(actual, expected, description) : Tests whether the reference is the same as the expected object (it is equivalent to the Is operator)
    • NotSame(actual, expected, description) : Tests whether the reference is different from the expected object.
  • Requirements

06.05.2016 / 01:04