QTP code to update test status in QC
I am working on QTP 10.0 and I am looking to update my testcases in QC from QTP. Can someone ple开发者_运维知识库ase pass me the code. The code which I got from the internet is using TDAPIOle80 object which I think is used for Test Director. Presently for QC we should be using QCUtil. Can someone please help me on this
Try this link. Here it gives step by step in different blog entries, on how to make Quality center connection, how to open a qtp test , how to save test execution results etc all through vbscript file.
VBscript sample example for QTP and QC
I will give you hints how to find your way in the QC API, but connecting to QC and finding a testcase is a higher science while updating the testcase with correct runsteps is even more challenging. You certainly need the QC API documentation to really unlock all possibilities: Login to QC, go to Help-->Documentation library and download it there.
I used to use Set tdc = QCUtil.QCConnection
for setting the QCConnection, but it turned out to be unstable in our projects.
Now using Set tdc = CreateObject("TDApiOle80.TDConnection")
and that is working. As an extra benefit, I you generalize your code enough you can use library where you use the TDApiOle80 method outside QTP (in plains VBS or VBA).
After making the tdc object, you can use
tdc.InitConnectionEx "https://qualitycenter.mydomain.com:8443/qcbin"
to connect
and
tdc.Login "User01", "Password01"
to login.
If you have a authorized connection you can iterate through your releasenodes with
Set ReleaseNodes = tdc.TestSetTreeManager.Root.Subnodes
< returns a releasenodes collection. When there are subnodes, you can recursively iterate the subnodes until you have found the releasenode you are aiming for.
Once you have a valid releasenode, you need the testinstance (testcase). You can find a testcase by using: FindTestInstances("MyTestcase", False, "")
(this returns a collection of matching testcases)
You can update the status of a testcase by creating a RunStep with the RunFactory and add it to the testcase.
精彩评论