6
I am in need of a help to do ASP unit testing for a software quality project. It is possible to do this?
Remembering that it is classic ASP.
6
I am in need of a help to do ASP unit testing for a software quality project. It is possible to do this?
Remembering that it is classic ASP.
7
The classic ASP (Active Server Pages), just to be 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: https://sourceforge.net/projects/aspunit/files/ (last update 2004).
In the folder
TestASPUnit
has an example test.
As an alternative I also found this https://github.com/rpeterclark/aspunit (is much more up-to-date)
This is a minimal example of configuration:
<!-- #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)
: Test if the value is True
Equal(actual, expected, description)
: Tests if the value is equal to the expectedNotEqual(actual, expected, description)
: Tests if the value is different from the expectedSame(actual, expected, description)
: Test if the reference is the same as the expected object (equivalent to the operator Is
)NotSame(actual, expected, description)
: Tests if the reference is different from the expected object.Requirements
Browser other questions tagged unit-testing asp
You are not signed in. Login or sign up in order to post.
Changing of technology :)
– Maniero
Unfortunately it is not possible :/
– Andre Lima
It makes no sense. Unit test tests code behavior, checking whether certain outputs are produced according to the input data. The output of an Asp (as well as Asp.Net, xhtml, etc.) is a graphical user interface. So you don’t need unit tests but UI tests. These tests consider the code generated for the browser and not the code you wrote in Asp. Therefore, as long as the code generated is html and Javascript, the test tools are the same regardless of the technology underneath. To test UI from the browser, have a look at Selenium.
– Caffé
is possible using frameworks for ASP.. as we have in PHP and several other ASP-like languages.
– Daniel Omine