Getting all the 'Runs' of Test Scripts fro

2019-06-05 12:51发布

问题:

Could some one help me in getting the below task done. It will be great help.

Ex:

I have a Test Script in Test Lab in a particular path in QC.

I need to develop a OTA, which will provide me 'All Runs' of the Test Script present in the path that I give. Say, I have 20 scripts in a path "Path1"(Basically the Test Lab path). So when i give this path as input, can i get all the scripts present in it and all their execution Runs. Ex: A test script 1234 is initially "Failed", then next day if it is "Passed". Then I need to get both these statuses out from Qc for all the Test Scripts.

Is this possible? I knew, we need to access the RUN table for the scripts in the given path. But could some one help me.

Thank you in advance..!

回答1:

First you need to get the test set in which your scripts are located. (The example below is in Ruby, but it should be no problem to adapt it. @tdc is the TDConnection object):

test_set_tree_manager = @tdc.TestSetTreeManager
test_set_folder = test_set_tree_manager.NodeByPath("Root\\Some\\Path\\To\\Lab\\Folder")
test_set_list = test_set_folder.FindTestSets("Name of test set")
test_set = test_set_list.Item(1)

Then you need to get the test instances (TSTest) from which you want to get the runs:

test_set_factory = test_set.TSTestFactory
found_test_instances = test_set_factory.NewList("")

Finally, get all the runs from some test instance:

test_instance = found_test_instances.Item(1)
run_factory = test_instance.RunFactory
runs = run_factory.NewList("")

runs is a List which contains all the test runs of test_instance.



标签: ota qc