Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

How Migrate Result inside another instance


Hi, my team is actually doing a merge on another instance, we figured how to do it by rest api, but can’t migrate the results, in the overview of each project all the data shows as 0 (0 passed, 0 blocked, 0 failed), is there a way to migrate this info??


Hi there,

Thanks for your posting. Test cases are best migrated using TestRail’s XML export/import:

Other objects such as projects, milestones or test runs/results can be migrated via TestRail’s API. Can you let me know which API methods you already use? Have you already migrated the test cases?



Yes i use that method for migrate, and for the rest of items i was using rest api (i.e get all runs of instance A and save it on instance B), but the results keep being 0

As it shows the results don’t look like be migrated


Can you check on the Status page of the run/plan if results were really added? Do you check the result/response of the API method you called to submit the results?



Well actually checking there’s no tests on the runs, I was using the method add_run and in those don’t include something referred to add the tests. For the Test can’t see a way to insert it into the run, is some method I can use to add the old test in the new runs, to migrate the results too?


If there are no tests, you may have started the run with the include_all option set to false but didn’t specify a case selection. include_all determines if all cases should be included in a run or just a subset of cases (which you can then specify via case_ids). Could you review this part of your script?



Yes here’s

try {
$res = $client->request(‘POST’, $destinyUrl . ‘/index.php?/api/v2/add_run/’ . $ProjectId, [‘auth’ => reset($authUserDestiny),
‘json’ => $TestRunForSave,
‘verify’ => ‘cacert.pem’,
‘headers’ => [‘content-type’ => ‘application/json’, ‘Accept’ => ‘application/json’]]);
$testRunsData = json_decode($res->getBody()->getContents());
if ($TestRun->is_completed) {
$client->request(‘POST’, $destinyUrl . ‘/index.php?/api/v2/close_run/’ . $testRunsData->id, [
‘auth’ => reset($authUserDestiny),
‘verify’ => ‘cacert.pem’,
‘headers’ => [
‘Content-Type’ => ‘application/json’
} catch (GuzzleException\BadResponseException $e) {
$exception = $e->getMessage();
array_push($errorList, $exception);

$TestRunForSave posess



object(stdClass)#48 (7) {
string(68) “Fire TV demo quality / no MSO / no live_tv tag / no voice_search tag”
array(139) {

After import it on the other instance, the results don’t update. I think is because it never was sended too

this is the result


Thanks! This would only add the test run itself and not the results and this would explain the behavior you see. To add results as well, you can use one of the add_result API methods:

add_result_for_case is likely the best fit and expects the run and case IDs.

I hope this helps!