How can we force the user to link a defect to a Blocked or Failed test step?
Question ID: 106528
0
0

I was able to write the code for making the linkage mandatory in the test execution grid if a user is changing the status to blocked or failed, but i am not able to make the linkage mandatory in case of a user just goes and start the manual run and marks a step as failed or blocked.

Can somebody help me with this?

Marked as spam
Posted by (Questions: 1, Answers: 3)
Asked on December 2, 2015 4:57 am
94 views
Answers (6)
1
Private answer

If you are in QC/ALM version 11.52 or higher, there is a new BugLinkFactory to assist with the linkage. This makes things ''a little'' easier.

Try the below example:

Function Step_FieldCanChange(FieldName, NewValue)
On Error Resume Next

'If the ST_STATUS field is changing...
If FieldName = ''ST_STATUS'' Then

'If the new value is going to be Failed or Blocked...
If NewValue = ''Failed'' or NewValue = ''Blocked'' Then

'Get the Step ID of the current Step.
StepID = Step_Fields.Field(''ST_ID'').Value

'Get the Step factory from the StepID
Set StepFact = TDConnection.StepFactory

'Get the Step object from the Step Factory
Set StepObj = StepFactory.Item(StepID)

'Get the BugLinkFactory from the Step
Set BugLinkFact = StepObj.BugLinkFactory

'Set a blank filter to find all the current defects in the BugLinkFactory
Set BugLinkFactFilter = BugLinkFact.Filter

'Apply the filter and add the filtered items to a list
Set BugLinkFactList = BugLinkFactFilter.NewList

'Check the list to see if it is empty
If BugLinkFactList.Count = 0 Then

'Inform the user.
MsgBox ''You must link a defect.''

'Block the status change
Step_FieldCanChange = False

'leave
Exit Function

End If

'Kill the objects
Set BugLinkFactList = Nothing
Set BugLinkFactFilter = Nothing
Set BugLinkFact = Nothing
Set StepObj = Nothing
Set StepFact = Nothing

End If
End If

On Error GoTo 0

End Function

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on December 2, 2015 11:07 pm
0
Private answer

you mention linking a defect. Are you wanting to force the user to select an existing defect or create a new defect when step status changes to failed / blocked?

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on December 2, 2015 2:57 pm
0
Private answer

Dear @Jafar, first of all thank you for your interrest.
I would like to force the user to link an defect... The linkage can be done in two ways... By adding it from the new defect button or just create a link with an existing one, but the result is the same... The step would have a link between the failed/blocked step and thr defect. So the answer is: if you select the status blocked ... Check if any linkage exist if not do not allow to change status and revert to old status.

I have done the same for the execution grid and test runs but i was not able to do it for the manual runner.

Marked as spam
Posted by (Questions: 1, Answers: 3)
Answered on December 2, 2015 3:05 pm
0
Private answer

@jafar, Thank you so much. It worked just perfectly, really appreciate your support.

@jafar do you also have any idea how to force the users to add attachments when raising defects?
I tried different ways but that flag for attachments just doesn't seem to be changing properly. i am on ALM 12.20.

Thank you again!

Marked as spam
Posted by (Questions: 1, Answers: 3)
Answered on December 6, 2015 3:25 am
0
Private answer

adip,

I've been down that road before. There just isn't a way to do this. I would recommend opening an Enhancement Request with HP for this to see if they will provide some option in a future release.

failed options:

1) BG_BUG_ID field is not updated until after the defect is created.
- This prevents access to the api for checking the attachments object.

2) BG_ATTACHMENT field is not updated until after the defect is created.
- This prevents a workflow check on the BG_ATTACHMENT field value.

3) The Attachment_* workflow triggers don't fire off in New Defect.
- This prevents setting a flag when the attachments are added.

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on December 7, 2015 9:24 pm
0
Private answer

@Jafar, thank you for confirming the same thing that i encountered, actually i will raise an issue with HP, as we still are under support.

Thanks again for all the support offered.

Marked as spam
Posted by (Questions: 1, Answers: 3)
Answered on December 8, 2015 3:09 am
EyeOnTesting

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

X
Scroll to Top