Thanks for responding! Here is what I have tried:
Say I have 3 tests T1, T2 and T3 and I have selected T1 and T2 during the test run. I hit Start Automated Tests button (created via ui script) to call trigger.php residing on the local Windows server.
In the UI script, I have declared a var called
test_ids as below:
var test_ids = App.Tables.getSelected($(’#groups’))
and my ajax call has a url field as:
url: “trigger.php?ids=” + test_ids.join(’,’)
…as per your suggestion and I believe this will hold the tests T1 and T2 (a/c to my understanding).
Here is the complete script:
name: Automated Tests Trigger
description: This script triggers automated tests for the test cases selected during the test run here on TestRail.
author: Pratik Jaiswal
/* Create the button called Start Automated Tests*/
var image = uiscripts.env.resource_base + "images/icons/running.png";
/* Add the button to the toolbar */
/*Get the test id's from the selection made during the current test run*/
var test_ids = App.Tables.getSelected($('#groups'))
/* Add click event to the button that we have created above. We are making an AJAX call to run trigger.php which is
located on our local Windows server. At the same time, we are passing the test ids for the current selection and you can
see the selection formatted as a comma separated string.*/
url: "trigger.php?ids=" + test_ids.join(','),
'An error occurred while trying to trigger the automated tests.'
'The tests are being processed in the background and the results are automatically posted back to TestRail. This page refreshes once the tests are finished.',
trigger.php on the local server has the following content:
echo 'Hello ' . htmlspecialchars($_GET["test_ids"]) . '!';
However, nothing is getting stored into the file “myget.txt” but test_ids array should hold the content of tests T1 and T2?. Correct me if I am wrong.
Thanks again, Pratik!