I found a test suite that is pretty basic but in about 10 minutes I was able to edit it to do some cool stuff. It is based off of xUnit and looks very similar in architecture to JUnit, but it is done in VBScript. It's at http://aspunit.sourceforge.net/
I think it's mentioned earlier, but here is the address. -- Michael Rasmussen
; this tests the ASP pages using http requests.
You can test for specific tags in the HTML response, and, for database driven sites,
you can also test and monitor relevant database tables.
The tests and test data are written in XML.
I helped to develop this open source application, and I have used it for both ASP and cold fusion pages.
Ok. The people below seem to be relying on ComObjects?
for their UnitTest
s. However, some of us are hired to do large amounts of work in an environment where we don't control the server, and aren't allowed to register our own ComObjects?
. So, given those constraints, how does one do ASP UnitTest
You could write a specialized UnitTest framework in script. See OoAspPractices.
Check out ASPUnit over at SourceForge
-- Adrian Edwards
We're currently working on an architecture to do this. It consists of an in-house ComUnit
infrastructure where a specific ASP UnitTest
component exists for executing an configured ActiveServerPage
and getting back a result in XML. The XML is then translated and propagated into the ComUnit
architecture by the aforementioned component.
More details when they become available.
We avoid putting code in the ASP and push it down into COM objects. Testing COM objects is much easier (from VB). Also there is a gotcha with ASP; if it loads a COM object, it keeps the object reference until PWS (or IIS) is stopped. Meaning you can't rebuild the COM object and retest the ASP page without stopping and restarting PWS. What a pain! -- IanRae
That's fine, but how do you test collection and data-scrubbing from an HTML form? Do you put all that logic into a component?
All I want is LITE
objects. The various syntaxes that #include source files between the various ASP, HTML, JS or WSF formats have screwed me. I must either "manually include" the testee by reading it as a file and running eval()
into a COM object using WSC, and then risk the COM bugs listed above. What a pain! Click here to read more whining:
And here for the solution:
There's a COM available called Http2Asp and it can call ASP pages and return with the HTML produced. You could match this against an expected result.
See also: ActiveServerPages