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

Inserting results directly to database


I have to say that I am very impressed by this tool. Currently I am put together a demo to show that all our projects in various tools (.net unit test unit nunit, java test using junit, selenium, soapui, and manual tests using excel docs) can be exported to testrail.

Due to a alack of full API, we are trying to insert them directly to the database. I don’t see too much documentation around this.

would it be possible to write a blog post on how to create a complete run via database inserts.

so for example.

I have already defined a project, milstones, and testsuites, and testcases for the project. Now when I run my automated tests via some framework like hudson/Cruise Control, etc, I would like to

  1. Create a new testplan in testrails for some project and assign suites to this testplan.
  2. insert results for the testcases in my automation to the corresponding tests in the testplan from #1
  3. assign all the failures to some person that is defined in testrails

If you can describe this in the blog, it would greatly speed up my effort to do this demo for the company.



Hello Ali,

Thanks for the message and great to hear that you’ve enjoyed working with TestRail so far. I agree that a more extensive API would be very useful and it has a high priority for us. That said, we already have a slightly more useful API available on request. That is, the Mini API only allows you to submit results for tests (via the test ID), but the extended version allows you to:

]Start a test run[/]
]Submit results for tests via the test ID[/]
]Submit results for tests via the test case + run ID[/*]

We have not yet replaced the available Mini API with the extended version as we would like to include such an API in TestRail soon. That said, we might either be able to extend the API for you (and other customers who are interested in this) to also start test plans. Or we might be able to provide you with details on how to do this via the database.

Either way, I’m sure that we will find a good solution for your scenario and I will make sure to contact you via email tomorrow to request a few more information.



would it be possible to publish the ER diagram for your database. It would be very helpful to see how the table are related to each other.


Hello Ali,

Yes, we should be able to publish an ER diagram. I have no time frame for this, but I will look into this later this week.

PS: I’ve changed your forum username to just ‘ali.raza’ to make sure that your email address is not visible to spammers.



Was this ER Diagram ever posted?


Hello Brian,

Yes, this is available. The diagram is for TestRail 2.3, but the database layout hasn’t changed significantly since this version. I will make sure to email it to you later today.



I am in the same boat as Ali, I am currently evaluating this product. One thing I really like is the integration of Youtrack, which we use. We are extremely data intensive so we have a bunch of stored proc’s to QA the data quality.

It would be great if you could let me know if you guys plan to release some kind of documentation on what needs to be inserted directly into the testrail tables to 1. Start a test, 2. Submit test result and etc…



Thanks for the feedback. You do not need to insert data directly into TestRail’s database to automate the creation of test cases, adding results or starting test runs. You would simply use TestRail’s API for this and this has been available for quite some time:

TestRail’s API allows you to automate various parts of TestRail and its simple HTTP calling convention makes it very easy to integrate it with various scripts or tools.

I hope this helps.