我正在寻找适用于WSH脚本(vbs/wsf,不包括VB6、VBA)的单元测试框架。
除了这个项目(看起来不错,但是最近一次活动记录是大约两年前,我还没有测试过),我找不到其他任何东西:
http://code.google.com/p/vbslib/
谢谢!
我正在寻找适用于WSH脚本(vbs/wsf,不包括VB6、VBA)的单元测试框架。
除了这个项目(看起来不错,但是最近一次活动记录是大约两年前,我还没有测试过),我找不到其他任何东西:
http://code.google.com/p/vbslib/
谢谢!
还有一个名为ScriptUnit的工具。如果你在Google上搜索“vbscript unittest”,你会找到我曾经发布过的一篇古老的帖子(并不太成功)。我仍然对这个话题感兴趣,并希望以适合您的方式进行合作。
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
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