51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2617|回复: 3
打印 上一主题 下一主题

[求助] QC10 Demo 工作流定制实例

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-7-29 17:42:16 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
' Set UI properties of the given field
' Arguments:
'     FieldName (string)      - the name of the field
'     fldIsRequired (boolean) - value of IsRequired property of the field
'     fldIsVisible (boolean)  - value of IsVisible property of the field
'     fldPageNo (number)      - value of PageNo property of the field
'     fldViewOrder (number)   - value of ViewOrder property of the field
Sub SetFieldProperties(FieldName, fldIsRequired, fldIsVisible, fldPageNo, fldViewOrder)

  Fields(FieldName).IsVisible = fldIsVisible
  Fields(FieldName).IsRequired = fldIsRequired
    Fields(FieldName).PageNo = fldPageNo
    Fields(FieldName).ViewOrder = fldViewOrder

End Sub

' Verify the Severity and Priority values correspondance to defect Category
Function Verify_PriorityByCategory

  Select Case Fields("BG_USER_05").Value
      ' The 'Functionality Suggestion' must have the Severity and Priority <= 3 - High
      Case "Functionality Suggestion"
          If Not Fields("BG_SEVERITY").IsNull And _
               Fields("BG_SEVERITY").Value <> "3-High" And _
               Fields("BG_SEVERITY").Value <> "2-Medium" And _
               Fields("BG_SEVERITY").Value <> "1-Low" Then
                 ReportError "The 'Functionality Suggestion' <Severity> should be '3-High' or lower."
                Verify_PriorityByCategory = False
                Exit Function
            End If
           If Not Fields("BG_PRIORITY").IsNull And _
               Fields("BG_PRIORITY").Value <> "3-High" And _
               Fields("BG_PRIORITY").Value <> "2-Medium" And _
               Fields("BG_PRIORITY").Value <> "1-Low" Then
                 ReportError "The 'Functionality Suggestion' <Priority> should be '3-High' or lower."
                Verify_PriorityByCategory = False
                Exit Function
            End If
        Case "UI Suggestion"
          If Not Fields("BG_SEVERITY").IsNull And _
               Fields("BG_SEVERITY").Value <> "2-Medium" And _
               Fields("BG_SEVERITY").Value <> "1-Low" Then
                 ReportError "The 'UI Suggestion' <Severity> should be '2-Medium' or lower."
                Verify_PriorityByCategory = False
                Exit Function
            End If
           If Not Fields("BG_PRIORITY").IsNull And _
               Fields("BG_PRIORITY").Value <> "2-Medium" And _
               Fields("BG_PRIORITY").Value <> "1-Low" Then
                 ReportError "The 'UI Suggestion' <Priority> should be '2-Medium' or lower."
                Verify_PriorityByCategory = False
                Exit Function
            End If
        Case "Security Issue"
          If Not Fields("BG_SEVERITY").IsNull And _
               Fields("BG_SEVERITY").Value <> "3-High" And _
               Fields("BG_SEVERITY").Value <> "4-Very High" And _
               Fields("BG_SEVERITY").Value <> "5-Urgent" Then
                 ReportError "The 'Security Issue' <Severity> should be '3-High' or higher."
                Verify_PriorityByCategory = False
                Exit Function
            End If
           If Not Fields("BG_PRIORITY").IsNull And _
               Fields("BG_PRIORITY").Value <> "3-High" And _
               Fields("BG_PRIORITY").Value <> "4-Very High" And _
               Fields("BG_PRIORITY").Value <> "5-Urgent" Then
                 ReportError "The 'Security Issue' <Priority> should be '3-High' or higher."
                Verify_PriorityByCategory = False
                Exit Function
            End If
        Case Else
    End Select

    Verify_PriorityByCategory = True

End Function

' Report error (message box) to the user
Sub ReportError(Msg)
  MsgBox Msg, vbCritical + vbOKOnly, "Workflow Error"
End Sub
  '**********************************************************

Sub Bug_New
  Fields = Bug_Fields
  '********************************************
'Enter code to be executed before opening a new bug form

  ' Set fields layout in the Add Defect form
  AddDefect_SetFieldsLayout
    ' Set default values for the fields
    AddDefect_SetDefaultValues

  '********************************************

End Sub


Sub Bug_FieldChange(FieldName)
  Fields = Bug_Fields
  '********************************************
'Enter code to be executed after a bug field is changed

    ' Set RDComments_IsChanged flag if the R&D Comments field was changed
    If FieldName = "BG_DEV_COMMENTS" Then
      RDComments_IsChanged = True
    ' Set Status_IsChanged flag if the Status was changed to 'Rejected' or 'Reopen'
    ElseIf FieldName = "BG_STATUS" Then
      If Fields("BG_STATUS").Value = "Rejected" Or Fields("BG_STATUS").Value = "Reopen" Then
        Status_IsChanged = True
        Else
          Status_IsChanged = False
        End If
    End If

  '********************************************
  WizardListCust ' Added by wizard

End Sub


Sub Bug_MoveTo
  Fields = Bug_Fields
  '********************************************
'Enter code to be executed after another bug receives focus

    DefectDetails_SetFieldsLayout

    ' When moving to the defect, its R&D Comments and Status fields were not changed yet
    RDComments_IsChanged = False
    Status_IsChanged = False

  '********************************************
  WizardListCust ' Added by wizard

End Sub


Function Bug_CanPost
  Fields = Bug_Fields
  Bug_CanPost = True
  '********************************************
'Enter code to be executed before current bug is posted
'if you want to abort posting, use Bug_CanPost = False

  ' For new defect (that was not submited yet, BG_BUG_ID is always Null
    ' This can be used to perform diferent verifications for defects
    If Fields("BG_BUG_ID").IsNull Then
      ' Verify the constrains for the new defect before submit
      Bug_CanPost = AddDefect_VerifyConstrains
    Else
      If Status_IsChanged And Not RDComments_IsChanged Then
          ReportError "You must provide the explanation in <R&D Comments>" & _
                  " when defect <Status> is changed to '" & Fields("BG_STATUS").Value & "'"
        Bug_CanPost = False
        End If
    End If

    ' Verify the Severity and Priority accordance to defect Category
    If Bug_CanPost Then
      Bug_CanPost = Verify_PriorityByCategory
    End If


  '********************************************
  If Not Bug_CanPost Then
    Bug_CanPost = False
    Exit Function
  End If
'**********************************************************
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    开心
    2017-7-4 15:34
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    4#
    发表于 2009-8-5 16:22:20 | 只看该作者
    不错。有机会学习下。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
    发表于 2009-8-5 15:37:32 | 只看该作者
    辛苦
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    2#
    发表于 2009-7-31 11:35:48 | 只看该作者
    辛苦,从帮助里抠下来并都放在一起的实例……
    呵呵,有参考价值。
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-26 15:19 , Processed in 0.068596 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表