Timeout running testset using OTA api



I have written a program that will using the ALM OTA Api start an execution of a test set and then download the result and convert it to HTML report.  This works fine in most cases but when a test set contains a test that takes longer than ALM disconnect timeout the execution of the test will finish but ALM marks the test as "Not compeleted" with execution time set to 0.


My code looks something like this


In my testsetrunner class I first get the testset from alm, then wait for it to complete. On the next call to GetTestSet after the run I get exception that ALM connection timed out.

var testset = _repository.GetTestSet(ts.Id);


var afterRunTestSet = _repository.GetTestSet(ts.Id);


public void StartExecutionAndWaitForComplete(int id)


var testSetFactory = ALM().TestSetFactory;

var testset = testSetFactory[id];

_scheduler = testset.StartExecution("");

_scheduler.RunAllLocally = true;


var execstatus = _scheduler.ExecutionStatus;

var finished = false;

while (!finished)


execstatus.RefreshExecStatusInfo("all", true);

finished = execstatus.Finished();







// And the ALM function looks like this

private TDConnection ALM()


if (_alm == null)


_alm = new TDConnection();



if (!_alm.Connected)




if (!_alm.LoggedIn)


_alm.ConnectProjectEx(DataStorage.Instance.ParameterDomain, DataStorage.Instance.ParameterProject,

DataStorage.Instance.ParameterUser, DataStorage.Instance.ParameterPassword);


return _alm;