Customize QC workflows to limit the size of uploaded attachments

Source: Internet
Author: User

To prevent some testers from uploading large attachments to QC, you can use the following script to customize the QC workflow:

 

Sub Attachment_New(Attachment)
  'Use ActiveModule and ActiveDialogName to get the current context.
  On Error Resume Next
 
    'Remove new attachment if file size is too big
    If Attachment.Type = 1 then 'Attachment is of type TDATT_FILE - a file.
       MaxFileSize = 3145728 'Set the maximum attachment size in Bytes <<- 3mb is our limit!
       If Attachment.FileSize > MaxFileSize then
          Select Case Attachment.Field("CR_ENTITY")
                 'Requirement
                 Case "REQ"
                      Set attRec = ReqFactory.Item(Attachment.Field("CR_KEY_1"))
                 'TestPlan
                 Case "ALL_LISTS" 'Folder
                      Set attRec = TreeManager.NodeByID(Attachment.Field("CR_KEY_1"))
                      msgbox attRec.ID
                 Case "TEST" ' Test
                      Set attRec = TestFactory.Item(Attachment.Field("CR_KEY_1"))
                 Case "DESSTEPS" 'Test step
                      Set attTest = TestFactory.Item(Test_Fields("DS_TEST_ID").Value)
                      Set attRec = attTest.DesignStepFactory.Item(Attachment.Field("CR_KEY_1"))
                 'TestLab
                 Case "CYCL_FOLD" 'Folder
                      Set attRec = TestSetTreeManager.NodeById(Attachment.Field("CR_KEY_1"))
                 Case "CYCLE" 'Test Set
                      Set attRec = TestSetFactory.Item(Attachment.Field("CR_KEY_1"))
                 Case "TESTCYCL" 'TestInstance
                      Set attRec = TSTestFactory.Item(Attachment.Field("CR_KEY_1"))
                 Case "RUN" 'Run
                      Set attRec = RunFactory.Item(Attachment.Field("CR_KEY_1"))
                 Case "STEP"  'Run Step
                      Set attRun = RunFactory.Item(Step_Fields("ST_RUN_ID").Value)
                      Set attRec = attRun.StepFactory.Item(Attachment.Field("CR_KEY_1"))
                 'Defects
                 Case "BUG"
                      Set attRec = BugFactory.Item(Attachment.Field("CR_KEY_1"))
          End Select
          set AttFac = attRec.Attachments
          Msgbox "Please exit this record and refresh the QC page. The file: " & vbLF & _
                 Attachment.Name & vbLf & " has been removed as it exceeds the required file size of 3mb."
          AttFac.RemoveItem(Attachment.ID)
       End If
    End If
 
  On Error GoTo 0
End Sub

 

 

Refer:

Http://www.jds.net.au/tech-tips/quality-center-attachments/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.