Code to Search for an Attachment under a Test Set in Test Lab of ALM
I have the following scenario:
I have a test set (say, TestSet1) in Test Lab with the following path :
<Root> \ Archive \ UFT Automation\
There are say 10 test cases associated to the test set 'TestSet1' (say, TC1, TC2, ......, TC10).
Now there are 50 test data (excel) files in the Attachment folder associated with the same test set (say, TD1.xls, TD2.xls, ..., TD50.xls). The mapping between the test case and test data sheet are one to one (say, TC1 is mapped to TD1.xls, TC2 is mapped to TD2.xls etc.)
Now I have to open each test case in QTP and before executing the same I have to check whether its corresponding test data excel is present in Attachment folder of the same test set, if yes only then the script should execute.
Can anyone please provide me the code to accomplish this?
I'd suggest you check ALM OTA API Reference for this purpose (from http://<your ALM server>:8080/qcbin/start_a.jsp > Help > Documentation library). There you can find the suitable objects and properties/methods to use as well as some code examples.
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
If there is a one-to-one mapping of test case to test data xls, why didn't you attach each xls to its test case, rather than attach all of them to a test set. And if each test case has a test data xls, and the test is a QTP script, why don't you import each data xls as a data table in QTP. Then you are assured that the data is available for the test, without having to make any checks. Including the test in a set will automatically run the test with the appropriate data table. A QTP data table is correct way to associate test data with the test script.