How to Synchronize Defects and Test Cases in HP ALM/QC

    EOL NOTE: We are moving Exalate for HP QC/ALM into basic maintenance mode. This transition period will last until June 2024, after which support will be halted completely. For more information, please see https://exalate.com/blog/end-of-support-hp/.

    This article shows how to synchronize defects and test cases in HP ALM/QC.

    Introduction

    Exalate allows you to synchronize the following entities in HP ALM/QC:

    • Defects
    • Test case (Test Lab module)

    You can add sync rules to every entity type separately.

    Note: Check the reference of supported fields and entities that you can synchronize from HP ALM/QC instance.

    Configuration

    To synchronize multiple entity types, you need to adapt the sync rules using if blocks. This helps Exalate distinguish sync rules for different entity types. Check the examples below:

    Source Side

    Outgoing sync

    To send defects and testCases use the code below  

    if(entityType == 'defect') {
    replica.key            = defect.key
    replica.owner          = defect.owner 
    replica.reporter       = defect.detectedBy
    replica.summary        = defect.summary
    replica.description    = defect.description
    replica.comments       = commentHelper.getSingleCommentFromCommentsArea(defect)
    replica.status         = defect.status
    replica.attachments    = defect.attachments
    	///other fields supported by the defect entity
    
    }
    
    if(entityType == 'testCase') {
    replica.key            = testCase.key
    replica.owner          = testCase.owner 
    replica.summary        = testCase.summary
    replica.description    = testCase.description
    replica.comments       = commentHelper.getSingleCommentFromCommentsArea(testCase)
    replica.status         = testCase.status
    replica.attachments    = testCase.attachments
    	///other fields supported by the test case entity
    }

    Destination Side HP ALM/QC

    You need to map the incoming entities. For example:

    • Jira issue of type bug to the HP ALM/QC defect
    • Jira issue of type story to the HP ALM/QC test case

    Below you can find some examples of mapping multiple issue types from Jira to different entities in the HP ALM/QC.

    Incoming sync

    Note: If you want to sync multiple entities in one connection, add the following code at the beginning of your Incoming sync rules.

    def defaultEntityType = 'defect' //Please change the defaultEntityType to 'testCase' to create test cases by default
    if(firstSync) entityType = defaultEntityType else entityType

    To create defects with the received information on your side, add the code below.

    def defaultEntityType = 'defect' //Please change the defaultEntityType to 'testCase' to sync into test cases by default.
    if(firstSync) entityType = defaultEntityType else entityType
    
    if(entityType == 'defect') {
        defect.summary      = replica.summary
        defect.severity     = "1-Low"
        defect.description  = replica.description
        defect.attachments  += replica.addedAttachments
        defect.attachments  -= replica.removedAttachments
        defect.commentsArea = commentHelper.mergeCommentsIntoCommentsArea(testCase, replica)
    }

    To create test cases with the received information on your side, add the code below.

    def defaultEntityType = 'testCase' //Please change the defaultEntityType to 'Defect' to sync into defects cases by default.
    if(firstSync) entityType = defaultEntityType else entityType
    
    if(entityType == 'testCase') {
        testCase.parentId     = qcHelper.getTestPlan("TEST").id
        testCase.typeName     = qcHelper.getTestType("VuGen-Script").id
        testCase.summary      = replica.summary
        testCase.description  = replica.description
        testCase.attachments  += replica.addedAttachments
        testCase.attachments  -= replica.removedAttachments
        testCase.commentsArea = commentHelper.mergeCommentsIntoCommentsArea(testCase, replica)
    }

    Note: To start the synchronization, create a trigger for every entity type separately.

    Have more questions? Ask the community