[TestDirector TD]
[OTA Attachments]
TestDirector 提供了开放式测试架构 (OTA, TestDirector Open Test Architecture) 规范,我们可以利用该架构提供的接口,将自定义的测试系统集成于TestDirector 中。其主要思路是针对TestDirector 的COM 接口编程实现。
详细代码如下:
Private Sub CommandButton1_Click()
On Error Resume Next
Dim td
Set td = CreateObject("TDApiOle80.TDConnection.1")
td.InitConnectionEx ""
td.ConnectProjectEx "TEST", "测试项目", "thehenry", ""
If Err.Number > 0 Then
MsgBox ("[ERROR:1]" & Err.Description)
Err.Clear
Exit Sub
End If
Dim factoryReq
Dim myReq
Set factoryReq = td.ReqFactory
Set myReq = factoryReq.AddItem(-1)
myReq.name = "TEST_" & "[" & Now & "]"
myReq.Author = "thehenry"
myReq.Field("RQ_USER_01") = "HEB_20070821_TEST"
myReq.Field("RQ_USER_15") = "334390"
myReq.Priority = "4-Very High"
myReq.Type = "常规"
myReq.Product = "经营分析"
myReq.Post
If Err.Number > 0 Then
MsgBox ("[ERROR:2]" & Err.Description)
Err.Clear
GoTo 100
End If
Set attf = myReq.Attachments
Set att = attf.AddItem(Null)
att.Filename = "E:\document\TD\TD8.0\Site_Admin_Client.pdf"
att.Type = 1
att.Description = "附件上传测试"
att.Post
Set att = Nothing
Set attf = Nothing
Set myReq = Nothing
100:
If td.Connected Then
If td.ProjectConnected Then
td.DisconnectProject
End If
td.releaseconnection
End If
MsgBox ("OK")
End Sub
Excle中VBScript宏实现示例如下:
|
文件: | TD_TestAttachments-B.rar |
大小: | 12KB |
下载: | 下载 |
|
阅读(1646) | 评论(0) | 转发(0) |