Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18120 Posts in 4741 Topics- by 31743 Members - Latest Member: suuraj
 

Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Update Status Field in Test Lab tab in QC    (Read 1306 times)
Sayan Sarkar
User
*
Offline Offline

Posts: 27


« on: February 25, 2009, 03:21:16 AM »

Hi,

Pre-Requisites:
1. User logged in to the Test Lab tab of QC.
2. A particular Test Set is selected which contains, say 15 scripts.
3. In an excel sheet, all the mentioned script names are present.

Requirement:
I need to update the status of each script, but step-wise, i.e., say for 1st script, I need to go into the "Begin Manual Run" section and update 3 steps to "Passed" status, the others will remain in Not Completed Status.

Query:
How do I progress in this case? Shall I use Sendkeys method in VBA or is the database updation more suitable in this case? If the latter one is true, please help me how to proceed in this case.

Thanx a lot in advance for your co-operation.
Logged
Raja Mohan Naidu
User
*
Offline 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
Logged
shrotriprasad
User
*
Offline Offline

Posts: 1


« Reply #2 on: March 10, 2010, 08:23:00 PM »

Hi Raja,

The Step where you are creating Run Instance, I have another field in QC that needs to be updated. Its a User Defined Field as RN_USER_01, Labeled as "BuildDate" and its a dropdown list. When I use the following code:
Set runF = lst(i).RunFactory
runName = "Run_" & Day(Now()) & "-" & Month(Now()) & "_" & Hour(Time) & "-" & Minute(Time) & "-" & Second(Time)

BuildDate = Sheet2.Cells(rr, 9)
Set tstRun = runF.AddItem(runName)
tstRun.Name = runName
                       
Set tstRun = runF.AddItem(bdte)
tstRun.BuildDate = Sheet2.Cells(rr, 9)
                                               
tstRun.Status = Sheet2.Cells(rr, 7)

I am getting error as Type Mismatch at second last line. Please help, as I stuck with execution.
Logged
Pages: [1]   Go Up
Print
Jump to: