Raja Mohan Naidu
User
Offline
Posts: 5
I am
|
 |
« Reply #1 on: March 09, 2009, 05:00:18 AM » |
|
Hi Sayan,
We can achieve this through OTA. Connecting to the TEst lab and corresponding folder and test set we can upload the results to the test case , steps, runs also.
here is the piece of code. we did one utility for this (uploading results to QC) Make the code accordingly
For cnt1 = CLng(Startrow of excel) To CLng(Endrow_excel) Set tsTreeMgr = td.TestSetTreeManager Set Root = tsTreeMgr.Root Set folder_List = Root.FindChildren("") list_flg = 0 For folder_cnt = 1 To folder_List.Count Set TSFolder = folder_List.Item(folder_cnt) If TSFolder.path = TestsetFolder_combo.Text Then Set testlist = TSFolder.FindTestSets("") For testset_cnt = 1 To testlist.Count If testlist.Item(testset_cnt).TestSetFolder.path = path of the test set folder Then Set tst = testlist.Item(testset_cnt) list_flg = 1 Exit For End If Next End If If list_flg = 1 Then Exit For End If Next Set TSTestFact = tst.TSTestFactory Set TSTestFilter = TSTestFact.Filter 'If Test name is found 'For Each Tsettest In TSTestList TSTestFilter.Filter("TS_NAME") = Trim(xlsapp.Worksheets(1).cells(cnt1, TestName_Colno)) MsgBox TSTestFact.NewList(TSTestFilter.Text) If "Root\Test\test1a\Test1" = TSTestFact.NewList(TSTestFilter.Text) Then MsgBox "if" Else MsgBox "else" End If Set TestSetTestsList = TSTestFact.NewList("Root\Test\test1a\Test1") MsgBox TestSetTestsList.Count For i = 1 To TestSetTestsList.Count MsgBox TestSetTestsList.Item(i) Next MsgBox TestsetTestList.Item(1) Set TSTest = TestSetTestsList.Item(1) TestId = TSTest.TestId Set tfact = td.TestFactory Set testfilter = tfact.Filter testfilter.Filter("TS_TEST_ID") = TestId Set tstlist = tfact.NewList(testfilter.Text) Set tst = tstlist.Item(1) TestName_flg = 1 Set Rnfactory = TSTest.RunFactory 'creating a run instance Set Rn = Rnfactory.AddItem(Trim(xlsapp.Worksheets(1).cells(cnt1, RunName_Colno))) Rn.CopyDesignSteps Set stpfactory = Rn.StepFactory Set StepList = stpfactory.NewList("") 'If step is found in the list For Each Stp In StepList If Trim(Stp.Name) = Trim(xlsapp.Worksheets(1).cells(cnt1, StepName_Colno)) Then StepName_flg = 1 'Loading the step details if a step field is found For cntr1 = 2 To endcol If cntr1 <> StepName_Colno Then If Trim(Mid(Trim(xlsapp.Worksheets(1).cells(1, cntr1)), 1, InStr(1, Trim(xlsapp.Worksheets(1).cells(1, cntr1)), "-") - 1)) = userlbl(1) Then 'If "NA field then it will not be ported 'porting step data to the specified field If Trim(xlsapp.Worksheets(1).cells(2, cntr1)) <> "NA" Then On Error GoTo unknown_err Stp.Field(Trim(xlsapp.Worksheets(1).cells(3, cntr1))) = Trim(xlsapp.Worksheets(1).cells(cnt1, cntr1)) On Error GoTo unknown_err Stp.Post End If End If End If Next 'Loading the run details For cntr1 = 2 To endcol If cntr1 <> RunName_Colno Then If Trim(Mid(Trim(xlsapp.Worksheets(1).cells(1, cntr1)), 1, InStr(1, Trim(xlsapp.Worksheets(1).cells(1, cntr1)), "-") - 1)) = userlbl(2) Then 'If "NA field then it will not be ported 'porting run data to the specified field If Trim(xlsapp.Worksheets(1).cells(2, cntr1)) <> "NA" Then On Error GoTo unknown_err Rn.Field(Trim(xlsapp.Worksheets(1).cells(3, cntr1))) = Trim(xlsapp.Worksheets(1).cells(cnt1, cntr1)) On Error GoTo unknown_err Rn.Post End If End If End If Next End If 'End of step name check Next ' End of step list for loop 'Loading the test details if a test field is found For cntr1 = 2 To endcol If cntr1 <> TestName_Colno Then If Trim(Mid(Trim(xlsapp.Worksheets(1).cells(1, cntr1)), 1, InStr(1, Trim(xlsapp.Worksheets(1).cells(1, cntr1)), "-") - 1)) = userlbl(0) Then 'If "NA field then it will not be ported 'porting test data to the specified field If Trim(xlsapp.Worksheets(1).cells(2, cntr1)) <> "NA" Then tst.Field(Trim(xlsapp.Worksheets(1).cells(3, cntr1))) = Trim(xlsapp.Worksheets(1).cells(cnt1, cntr1)) tst.Post End If End If End If Next
|