0

Anyone had also worked with TestRail(maybe by a click of a button) trigger automated test run in Ranorex and return the result/s back to testrail.

Would it be possible to share to us the steps you made and maybe a sample code.

Can you highlight how you run multiple test case in Ranorex.

Thanks!

Luvs1015
  • 9
  • 6

1 Answers1

0

I have used TestRails API binding for .NET (http://docs.gurock.com/testrail-api2/bindings-dotnet) for writing a simple C# file in Ranorex.

The idea is to have a test run with tests in TestRail and Ranorex posting to TestRail about the success of the test execution of these tests.

var testCase = TestCase.Current.Parameters["test_case"];
var runID = TestSuite.Current.Parameters["run_id"];

if (String.IsNullOrEmpty(testCase)) 
{
    Report.Failure("Test case '" + TestCase.Current.Name + "' has no test case id defined !");
    return;
}
if (String.IsNullOrEmpty(runID)) 
{
    Report.Failure("Test suite '" + TestSuite.Current.Name + "' has no run id defined !");
    return;
}

APIClient client = new APIClient("https://<your_server>");
client.User = "<user>";
client.Password = "<api_key>";

var data = new Dictionary<string, object>
{
    { "status_id", 1 }, // 1 = successful
    { "comment",  "test case executed in Ranorex" }
};
JObject r = (JObject) client.SendPost("add_result_for_case/" + runID + "/" + testCase, data);
Ranorex.Report.Info(r.ToString());

This posts the result for one case to Ranorex (therefore the add_result_for_case method. The runID is a parameter I give in command line when I execute the suite and each test case in Ranorex corresponds to one test case in TestRail and must hold the test case id.

Take a look at http://docs.gurock.com/testrail-api2/start about what possibilities the TestRail api offers

Emerson Cod
  • 1,990
  • 3
  • 21
  • 39