Timeout running testset using OTA api

Hi

 

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);

_repository.StartExecutionAndWaitForComplete(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;

_scheduler.Run();

var execstatus = _scheduler.ExecutionStatus;

var finished = false;

while (!finished)

{

execstatus.RefreshExecStatusInfo("all", true);

finished = execstatus.Finished();

 

ALM().RefreshConnectionState();

Thread.Sleep(5000);

}

}

 

// And the ALM function looks like this

private TDConnection ALM()

{

if (_alm == null)

{

_alm = new TDConnection();

}

_alm.RefreshConnectionState();

if (!_alm.Connected)

{

_alm.InitConnectionEx(GetUrl());

}

if (!_alm.LoggedIn)

{

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

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

}

return _alm;

}

 

 

Parents Reply Children