HP ALM OTA-API: How to update a test in testlab knowing the id?

3k views Asked by At

I know the id of a test that is in a Testset and want to update your status, know how to do it using the API OTA?

Edit:
Thanks but current answer unfortunately doesn't work for me . I put the example ( java) :

ITestSetFactory sTestFactory = (itdc.testSetFactory()).queryInterface(ITestSetFactory.class);
ITDFilter filterF=sTestFactory.filter().queryInterface(ITDFilter.class);
filterF.filter("TC_TEST_ID","531729");
System.out.println(filterF.newList().count());

The error:

Exception in thread "main" com4j.ComException: 800403ea (Unknown error) : Failed to Get Test Set Value : .\invoke.cpp:517
    at com4j.Wrapper.invoke(Wrapper.java:166)
    at com.sun.proxy.$Proxy13.newList(Unknown Source)
    at TestQC.main(TestQC.java:64)

Any suggestions ?

1

There are 1 answers

0
Roland On

The error occurs because you use the TestSetFactory instead of the TSTestFactory. You should use itdc.tsTestFactory() because it is TSTest objects you want to manipulate (aka test instances), not TestSet objects. The simplest way is to get the TSTestFactory of your TDConnection object, and use a filter to get the TSTest object and then set its status. Example code in Ruby:

ts_test_factory = tdc.TSTestFactory
filter = ts_test_factory.Filter
filter["TC_TEST_ID"] = "123" # test id from test plan
found_test_instances = filter.NewList
test_instance = found_test_instances.Item(1) # be careful if the test occurs in many test sets
test_instance.Status = "Passed"
test_instance.Post