Bulk Rename Steps
Question ID: 105933
1
0

We exported test cases from Excel into Quality Center using the Excel Add-in. When we did, the format used for the test step number imported as just a number into QC instead of "Step 1". Now when users manually add a step they are not able to renumber the steps. Is there an easy way to change the format of all the step numbers so that they include the word "step"? They have since revised the test cases so reimporting the same spreadsheet will not work.

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on February 9, 2015 10:25 pm
43 views
Answers (1)
0
Private answer

Create a Toolbar button with an ActionName of ''StepRename''. Then input the below workflow in the ActionCanExecute section of your Common Script. You will then be able to highlight a folder in the Test Plan and click the button. The script will look for any steps that do not contain ''Step'' in the name and rename them to add ''Step'' to the begining of the name. If the steps were numbered, an just had the Step prefix omitted, this should correct.


    If ActionName = ''StepRename'' Then
         Dim TestSubject, OldStepName
         TestSubject = TestFolder_Fields.Field(''AL_ITEM_ID'').Value

         Set TreeMgr = TDConnection.TreeManager
         Set TestNode = TreeMgr.NodeById(CLng(TestSubject))
         Set TestFact = TestNode.TestFactory
         Set TestFilter = TestFact.Filter
         Set TestList = TestFact.NewList(TestFilter.Text)

         For Each Test in TestList
             Set DesStepFact = Test.DesignStepFactory
             Set DesStepFilter = DesStepFact.Filter
             DesStepFilter.Filter(''DS_STEP_NAME'') = ''<>Step*''
             Set DesStepList = DesStepFact.NewList(DesStepFilter.Text)

             If DesStepList.Count > 0 Then

                Set TestVCS = Test.VCS

                If TestVCS.IsCheckedOut = ''False'' Then
                   TestVCS.CheckOut ''-1'', '''', False
                End If

                For Each Step in DesStepList
                    OldStepName = Step.Field(''DS_STEP_NAME'')
                    Step.Field(''DS_STEP_NAME'') = ''Step '' & OldStepName
                   Step.Post
                Next

                If TestVCS.IsCheckedOut = ''True'' Then
                   TestVCS.CheckInAndOverrideLastVersion ''''
                End If

                Set TestVCS = Nothing

             End If

             Set DesStepList = Nothing
             Set DesStepFilter = Nothing
             Set DesStepFact = Nothing
         Next

         Set TestList = Nothing
         Set TestFilter = Nothing
         Set TestFact = Nothing
         Set TestNode = Nothing
         Set TreeMgr = Nothing

         MsgBox ''Complete''
      End If

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on February 9, 2015 10:28 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top