| || |
Auto-Populating Defects with Test Plan Fields
Below is a piece of code that I'm trying to use to auto-populate defects with test plan fields, when you create a defect from within a test run. It is working when you first run the test run and create a new defect but if you stop, continue manual run (after someoneelse has ran another test set) then it won't pick up the correct run. The problem lies with the first select statement as this will always return most recent run started rather than the actual.
Has anyone out there come up with a way of selecting the 'actual' RUN_ID rather than the most recent ? I'm still looking into it myself and will post a response if I figure it out .
On Error Resume Next
Set tdc = TDConnection
Set com = tdc.Command
com.CommandText = "Select RN_TEST_ID,RN_STATUS from RUN where RN_RUN_ID = (Select MAX(RN_RUN_ID) from RUN)"
Set RecSet = com.Execute
Temp = RecSet.FieldValue(0)
Set com1 = tdc.Command
com1.CommandText = "SELECT TS_USER_07 FROM TEST where TS_TEST_ID =" & Temp
Set RecSet1 = com1.Execute
ApplicationName = RecSet1.FieldValue(0)
Bug_Fields.Field("BG_USER_10").Value = ApplicationName 'Assigning the Application Name to the user defined field in the defects form
On Error GoTo 0
Re: Auto-Populating Defects with Test Plan Fields
In lab/runner/sprinter save the test id to the user area (there is an example in the admin manual how to do this) and then retrieve it again in the defect module. You need to save the id in the event that is called when the tester clicks on new defect. The event name is different depending on if the tester is in the manual runner, test lab, or sprinter. This way you always get the correct test.