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

TestRail Integration with automation scripts


Hi Team,

My requirement is, I want to trigger automation scripts from Test Rail UI and also test cases statues should be updated back to test rail once the execution is done

Please find the steps that I’ve followed to do above requirement

  1. Customized Test Rail as suggested in the following link

  2. Modified “trigger.php” to trigger automation scripts

  3. Placed trigger.php file in local server

  4. Upon clicking on the customized button, ideally it should hit the “trigger.php” which starts jenkins job based on the selected run id

  5. I’ve written code snippet to update test statuses in Test Rail UI using API’s

Problem here is, it is unable to hit “trigger.php”

Find the modified trigger.php to trigger Jenkins job


runId = _GET[‘run_id’];

function listOfJobs($runIdToStart){
$service_url = ‘Jenkins URl’;
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
$arr = json_decode($curl_response, true);
$baseUrl = ‘http://IPwithport/job/’;
foreach ($arr[‘jobs’] as $element) {
$jobName = $element[‘name’];
if( strpos( $jobName, $runIdToStart) !== false) {
//echo $jobName;
$baseUrl = $baseUrl."$jobName/build";

$curlCmd = 'curl -X POST ';
$url = $baseUrl;
$commandToExecute = $curlCmd.$url;
//echo $commandToExecute;




Please correct/suggest me if I am wrong.

Thanks in advance,