Use Case:
Users tend to start a new run opposed to continuing a run that was previously started. The workflow needs to Continue the run if it previously exists. For people who count steps completed vs steps not run this will help in the reporting process.
Solution:
In ActionCanExecute:
If ActionName = "act_run" Then
'Capture the test status
strRunStatus = TestSetTest_Fields("TC_STATUS").Value
'If the status of the test is Manual Then check to see if it has any previous runs
If TestSetTest_Fields("TC_SUBTYPE_ID").Value = "MANUAL" Then
'If the Test Instance has any value OTHER than No Run, then execute
If Not(strRunStatus = "No Run" or strRunStatus = "") Then
'strInput = msgbox("Do you want to continue a previous run?", 3)
'If strInput = 6 Then
' 'Set to false, so the run_act action will not finish
Template_ActionCanExecute = False
'Call action to continue previous run
Actions.Action("act_continue_man_run").Execute
Else
Template_ActionCanExecute = DefaultRes
End If
End If
ElseIf ActionName = "UserDefinedActions.NewRun" Then
'Capture the test status
strRunStatus = TestSetTest_Fields("TC_STATUS").Value
'If the status of the test is Manual Then check to see if it has any previous runs
If TestSetTest_Fields("TC_SUBTYPE_ID").Value = "MANUAL" Then
'If the Test Instance has any value OTHER than No Run, then execute
If Not(strRunStatus = "No Run" or strRunStatus = "") Then
'Display a message box asking if the user is sure they don't want to continue the previous run.
strInput = msgbox("The test case you have selected has previous runs. Do you want to continue a previous run? " & vbcrlf & "hint: 99% of the time you will want to click the 'Yes' button", 3)
If strInput = 6 Then
'Set to false, so the run_act action will not finish
Template_ActionCanExecute = False
'Call action to continue previous run
Actions.Action("act_continue_man_run").Execute
ElseIf strInput = 7 Then 'Start new run
Actions.ACtion("act_run_manually").Execute
'Template_ActionCanExecute = DefaultRes
ElseIf strInput = 2 Then
' 'Then they canceled and do nothing.
Template_ActionCanExecute = False
Else
Template_ActionCanExecute = DefaultRes
End If
End If
Else
Template_ActionCanExecute = DefaultRes
End If
ElseIf ActionName = "act_run_manually" Then
strRunStatus = TestSetTest_Fields("TC_STATUS").Value
'If the Test Instance has any value OTHER than No Run, then execute
If Not(strRunStatus = "No Run" or strRunStatus = "") Then
'Is there is a test status that means there is already a run.
'So we cancel the action, and trigger the right action.
Template_ActionCanExecute = False
Actions.Action("act_continue_man_run").Execute
Else
Template_ActionCanExecute = Template_DefaultRes
End If
End If