Copy Code
|
|
---|---|
Private Function BuildTestsTree() As Test ' Create a subject folder and add a new Business Process Test Dim testF As TestFactory Dim NewTest As Test Dim oRoot As SubjectNode, folder As SubjectNode Dim TreeMgr As TreeManager ' This example creates a subject folder, which is a test folder ' in the test plan module,and places a new test of type ' Business Process Test in the folder. ' tdc is a TDConnection object. When this routine is run, the ' user is already authenticated and connected to the project. Set TreeMgr = tdc.TreeManager ' Create a test plan subject folder, Set oRoot = TreeMgr.TreeRoot("Subject") Set folder = oRoot.AddNode("myTestFolder2") ' Get a test factory from the new folder. Set testF = folder.TestFactory ' Create the test, Set NewTest = testF.AddItem(Null) NewTest.name = "myBPTest1" NewTest.Type = "BUSINESS-PROCESS" 'Put the test in the new subject folder. ' Note that because since we got the TestFactory from the ' folder, we don't need to set the TS_SUBJECT field. ' Had we created the factory object from the TDConnection: ' Set TestF = tdc.TestFactory ' we would have to place the test in the folder: ' NewTest.Field("TS_SUBJECT") = folder.NodeID ' Save the test. NewTest.Post ' Note that the object returned is of class Test, ' not of class BusinessProcess, even though the ' Type property is BUSINESS-PROCESS. ' To use methods and properties of BusinessProcess, ' the calling routine must cast the returned object ' to BusinessProcess. Set BuildTestsTree = NewTest End Function |