How to use SoapUI/Groovy to add Test Results to Quality Center Test Run?

How to use SoapUI/Groovy to add Test Results to Quality Center Test Run?

import org.codehaus.groovy.scriptom.*

def tstCaseName = "NAME_OF_TESTCASE"
tstCaseName = tstCaseName.replaceAll(/[ ]/) {  match ->

    //  Create an entry point for QC
    def tdc = new ActiveXObject ('TDApiOle80.TDConnection')

    //  Connect to QC, Login with Credentials, connect to Project
    tdc.Login('USER_NAME', 'PASSWORD')

    //  Find the set of tests in the Test Plan
    tsFolder = tdc.TestSetTreeManager.NodeByPath('Root\PATH\TO\TEST\CALENDAR\Spaces are allowed')
    tsList = tsFolder.FindTestSets('NAME_OF_TEST_CALENDAR')
    tsObject = tsList.Item(1)

    //  Get the list of TestCases in the Test Plan and filter it down to the one Test Case we are interested in
    TSTestFact = tsObject.TSTestFactory
    tstSetFilter = TSTestFact.Filter
    tstSetFilter.Filter["TS_NAME"] = '*' + tstCaseName
    TestSetTestsList = TSTestFact.NewList(tstSetFilter.Text)
    tsInstance = TestSetTestsList.Item(1)

    //  Create a new Test Run
    newRun= tsInstance.RunFactory.AddItem('Run_Auto')
    newRun.Status = 'Not Completed'

    //  Populate Auto Run Test step Data
    def tsStepData = new Object[3]
    tsStepData[0]='Auto Data'
    tsStepData[1]='Not Completed'
    tsStepData[2]='Results from Automated Test'
    //  Create new Test Step in the run with our Auto Run Data
    tsSteps = newRun.StepFactory.AddItem(tsStepData)
    tsSteps.Field['ST_ACTUAL'] = 'These are the actual results from my test!!'


Popular posts from this blog

How to change this to <%Html.ActionLink%> in my mvc application ?