ScriptUnit

This is a tester in the same vein as JUnit and NUnit, but for the ActiveX scripting languages.

It is similar to COMUnit, but without requiring the tests to be embedded in the testing application.

ScriptUnit loads tests dynamically, so you can focus on the tests rather than the framework.

ScriptUnit user interface

ScriptUnit is a unit tester that runs tests written in VBScript/JScript files.

The unit tests look like this:

Sub TestExamples

Assert.IsTrue "abc" = LCase("ABC")

Assert.IsFalse "a" = "b", "a and b should not match"

Assert.IsEqual 1/2, 0.5, "half and half don't match"

Assert.ExpectError "division by zero"

x = 1 / 0

End Sub

Scripts are easy to write and modify. Use your favorite editor to modify the script file, and just click the RUN button to reload the file and re-run the tests.

Drag files into the ScriptUnit window, or add whole directories of test files in one go.

Tests are easy to run and re-run – just click the button to load and run the current test again.

Test runs can be automated using the command-line. Results can be stored in an NUnit-compatible XML file. This means that tests can be easily integrated into an automated build system.

For example, to run all the tests in the MyTests folder, plus the C:\hairytest.vbs file,

and log the results to results.xml can be done like this:

ScriptUnit.exe /Q Mytests c:\hairytest.vbs /log results.xml

The command line switches used:

  • /Q = Quiet – do not show the GUI)
  • MyTests = Load this directory
  • c:\hairytest.vbs = Load this file as well
  • /log results.xml = Save the test results here

As can be seen from the 0.8 tag, this is not quite finished – there are still a few rough edges that need to be

sanded down before it is finished. At the moment it uses the Microsoft Script Control (OCX) to host the engines.

This works well enough for VBScript and JScript, but ActiveState PerlScript doesn’t work as well.

Once I’ve polished the code a bit more and thrown out the non-working parts, I’ll throw the source code up here

as well under LGPL.


Copyright 2005 Christian Mogensen – mogens@newmedia.no

Downloads

4 comments on this post.
  1. links for 2008-04-25 | Lazycoder:

    [...] asp) Post a comment — Trackback URI RSS 2.0 feed for these comments This entry (permalink) was posted on Friday, April 25, 2008, at 3:35 am by Scott. Filed inLinks. [...]

  2. ScriptUnitを使ってWSHでUnit Testを行う at WindowsServer管理者への道:

    [...] さらにScriptUnitに関しては明確にVBScriptとJScriptへの対応を謳っています。 This works well enough for VBScript and JScript, but ActiveState PerlScript doesn’t work as well. [...]

  3. ScriptUnitを使ってWSHでUnit Testを行う at WindowsServer管理者への道:

    [...] さらにScriptUnitに関しては明確にVBScriptとJScriptへの対応を謳っています。 This works well enough for VBScript and JScript, but ActiveState PerlScript doesn’t work as well. [...]

  4. Selenium WebDrivers binding resolution index and resource | ??:

    [...] VBS binding: http://htejera.users.sourceforge.net/vbswebdriver/ VBS test framework: http://www.xt1.org/scriptunit [...]

Leave a comment

You must be