https://github.com/rcdmk/classicaspunit
A classic ASP unit framework for helping in testing classic asp code.
https://github.com/rcdmk/classicaspunit
asp classic-asp unit-testing
Last synced: 2 months ago
JSON representation
A classic ASP unit framework for helping in testing classic asp code.
- Host: GitHub
- URL: https://github.com/rcdmk/classicaspunit
- Owner: rcdmk
- License: mit
- Created: 2012-10-10T13:45:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-16T02:55:31.000Z (over 12 years ago)
- Last Synced: 2023-03-12T10:01:36.552Z (about 2 years ago)
- Topics: asp, classic-asp, unit-testing
- Language: ASP
- Size: 117 KB
- Stars: 6
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Classic ASPUnit
===============A classic ASP unit framework for helping in testing classic asp code.
# Usage
Instantiate the context:set testContext = new aspUnit
Create a test case:set oTest = testContext.addTestCase("User Administration")
Make assertions:
oTestMethod.AssertExists usersDB, "optional message override: {1}" ' accepts a wildcard marks for the parammeters
oTestMethod.AssertIsA usersDB, "testDB", "" ' leave blank for default messageYou can also create test setups and teardowns to be executed before and after each test for a `Test Case`:
sub testSetup()
set usersDB = new testDBusersDB.TableName = "users"
set newUser = new User
newUser.id = 1
newUser.name = "Bob"
usersDB.add newUser
end subsub testTeardown()
set usersDB = nothing
end sub
... and then pass the method names for the Test Case:oTest.Setup("testSetup")
oTest.Teardown("testTeardown")
This would work too:oTest.Setup("myGlobalObject.MyMethod(1, ""param2"", true)")
> **Warning:** This uses `Execute` to run the code and will accpect any executable code string like `"myVar = 1"` or `"myFunction() : myOtherFunction()"`To run and get the results of the tests:
set results = testContext.run
results.Update ' This will update the test counters for passed, failed and errorsThen you can have access to the results and write any view you want:
Response.Write "Test Cases: " & results.TestCases.Count & "
"
Response.Write "Tests runned: " & results.Tests & ", "
Response.Write "Tests passed: " & results.Passed & ", "
Response.Write "Tests failed: " & results.Failed & ", "
Response.Write "Tests errored: " & results.Errors & "
"' loop the testCases
for each testCase in result.TestCases.Items
Response.Write "-> Test Case: " & testCase.Name & "(" & testCase.Status & ")
"
' loop the tests
for each test in testCase.Tests.Items
Response.Write "--> Test: " & test.Name & "
"
Response.Write "----> " & test.Output & "(" & test.Status & ")
"
next
next
>There is a template view with the source in the test folder.