标题: Multi Test Manager选择批量用例和执行 [打印本页] 作者: deadhunter 时间: 2012-2-24 16:59 标题: Multi Test Manager选择批量用例和执行 Multi Test Manager选择用例需要一个个选择,效率很低,下面是自己写的一个脚本,选择批量用例和执行。
'创建oMTM自动化模型组件
Set oMTM = CreateObject("MultiTestManager.Application")
For j=LBound(sPath) to UBound(sPath)
'利用TextStream对象来将字符串写入文件
objTStream.WriteLine sPath(j)
Next
objTStream.WriteLine "oMTM.Run"
objTStream.WriteLine "While oMTM.IsRunning : Wend"
'释放TextStream对象
objTStream.close
Set fso = Nothing
'批量执行用例
set ws = CreateObject("wscript.shell")
ws.run fPath
Set ws = nothing
'获取脚本路径
Function scriptPath(sourcepath)
Dim fso,objset,objFolders,FolderName,i
Dim myArray()
i = 0
Set fso = CreateObject("Scripting.FileSystemObject")
'使用GetFolder方法来返回Folder对象
Set objset = fso.getFolder(sourcepath)
'SubFolders属性将返回所有子文件夹对应的Folder集合
Set objFolders = objset.SubFolders
'遍历Folder集合,统计出共有多少个文件夹,及相关文件夹的名字
For Each objFolder in objFolders
Set objset1=fso.GetFolder(objFolder)
Set objFloders1=objset1.SubFolders
For each objFolder1 in objFloders1
ReDim preserve myArray(i) '设置动态数组
myArray(i) = "oMTM.AddTestScript """ & objFolder1 & """,True"
i = i + 1
next
Next
scriptPath = myArray
Set fso = Nothing
End function