WSH Script Module Testing Framework

I am looking for a unit testing framework for WSH scripts (vbs / wsf, not VB6, VBA).

I can’t find anything but this project (it looks good, but the last activity was a recorder about 2 years ago, I have not tested it yet):

http://code.google.com/p/vbslib/

Thanks!

+4
source share
2 answers

There is also ScriptUnit , and if you are just Google for the "vbscript unittest", you will find an ancient publication (not very successful). I am still interested in this topic and would like to collaborate in a way that suits you.

+3
source

I just clicked on the GitHub repository, which includes an ultra-lightweight VBScript-based unit testing platform. Now it has only AssertEqual and AssertErrorRaised, but it would be very easy to add more if necessary: https://github.com/koswald/VBScript

Here is a snippet from the spec file

With CreateObject("includer") Execute(.read("VBSValidator")) Execute(.read("TestingFramework")) End With Dim val : Set val = New VBSValidator 'Class Under Test With New TestingFramework .describe "VBSValidator class" .it "should return True when IsBoolean is given a True" .AssertEqual val.IsBoolean(True), True End With 

And here is a test run sample

 Main Sub Main With CreateObject("includer") ExecuteGlobal(.read("VBSTestRunner")) End With Dim testRunner : Set testRunner = New VBSTestRunner With WScript.Arguments If .Count Then 'if it is desired to run just a single test file, pass it in on the 'command line, using a relative path, relative to the spec folder testRunner.SetSpecFile .item(0) End If End With 'specify the folder containing the tests; path is relative to this script testRunner.SetSpecFolder "../spec" 'run the tests testRunner.Run End Sub 
+2
source

Source: https://habr.com/ru/post/1347242/


All Articles