unit testing vbscript functions
As a developer I can't stand not having unit tests. With IQ this actually becomes more important since think often silently fail and I personally can't get the debugger working. So I have been using a simple test approach with asserts to test my functions.
The idea is pretty simple. Whenever I write a function (e.g. MyFunc) I also write a test for it (e.g. MyFunc_Test). You can then run test function using the "Execute A Function" button.
I have the test function call my asserts. Here is the assert code I am using. If you are using a debugger that will give you a stacktrace you can uncomment the Err.Raise to go right to the problem. I often copy all my VBScript to a Excel VB Module to test it there for that reason.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Testing Code
- Read more about unit testing vbscript functions
- 1 comment
- Log in or register to post comments