Search code examples
vbscriptqtphp-quality-center

Writing to custom QC fields from QTP


I'm using QTP and QC 11 and am attempting to update a custom field in QC with details of a failed test (so we can easily see why a test failed without opening up the test run).

I've created a memo type field on the testcycle and on the run field.

My QTP code is as follows:

Dim oTestInTestSet, oCurrentRun
Set oCurrentRun = QCUtil.CurrentRun
Set oTestInTestSet = QCUtil.CurrentTestSetTest
oTestInTestSet.Field("TC_USER_25") = Environment("CriticalError")
oTestInTestSet.Post
oCurrentRun.Field("RN_USER_13") = Environment("CriticalError")

The run table is updated ok but the testcycle table is not. I can manually force the update (when the code is interrupted) by using the command tab - but this is no good when I am running tests from QC!

Any ideas why this might be happening? This used to work in QTP10.


Solution

  • For anyone stuck on this, HP have confirmed this is a defect in QC11.

    There are 2 workarounds: 1 - add the set operation twice, ie,

    oTestInTestSet.Field("TC_USER_25") = Environment("CriticalError")
    oTestInTestSet.Field("TC_USER_25") = Environment("CriticalError")
    

    2 - set the AutoPost property to true (the test will not be updated though until the 2nd run).

    HP could not say that it will be fixed in the next release. I currently use the 1st workaround and it's ok.