loader image

HP ALM/HPQC – Pass ‘Test Plan’ field values to ‘Defect’ module automatically when raising a defect from Test Lab (during execution).

HP ALM/HPQC – Pass ‘Test Plan’ field values to ‘Defect’ module automatically when raising a defect from Test Lab (during execution).

  1. Step 1:

Insert this code into the “Function ActionCanExecute(ActionName)” in common script

Under Common Scripts

Function ActionCanExecute(ActionName)

If ActionName = “act_add_bug” Then

Set us = TDConnection.UserSettings

us.Open “MySettings”

us.Value(“LastRunID”) = Run_Fields(“RN_RUN_ID”).Value

us.Close

us.Post

Set us = Nothing

End If

 

  • Step 2:

Insert this code into the “Sub Bug_New” in defect script module”

Under BUG_New

Set us = TDConnection.UserSettings

us.Open “MySettings”

lTestId = us.Value(“LastRunID”)

us.DeleteValue “LastRunID”

us.Close

‘Replace bug field name below

Bug_Fields(“<bug field name(s)>”).Value = “”

‘Sample code

‘Bug_Fields.Field(“BG_USER_02”).Value = “”

if lTestId <> “” then

‘Replace bug field name below

Bug_Fields(“<bug field name(s)>”).Value = “”

‘Sample code

‘Bug_Fields(“BG_USER_02”).Value = “”

Set TestRun = TDConnection.RunFactory.Item(lTestId)

TestID = TestRun.Field(“RN_TEST_ID”)

Set myTest = TDConnection.TestFactory.Item(TestID)

‘Replace bug field name and test field name below

Bug_Fields.Field(“<bug field name>”).Value = myTest.Field(“<test field name>”)

‘ Sample code

‘Bug_Fields.Field(“BG_USER_02”).Value = myTest.Field(“TS_USER_05”)

end if

Set myTest = Nothing

Set us = Nothing

No Comments

Post A Comment