触发从 Testrail 到 Ranorex 的自动化测试
Trigger Automated Test from Testrail to Ranorex
任何人也曾使用 TestRail(可能通过单击按钮)在 Ranorex 中触发自动测试 运行,然后 return result/s 返回 testrail。
是否可以与我们分享您所做的步骤以及示例代码。
你能强调一下你是如何在 Ranorex 中 运行 多个测试用例的吗?
谢谢!
我已经使用 TestRails API binding for .NET (http://docs.gurock.com/testrail-api2/bindings-dotnet) 在 Ranorex 中编写了一个简单的 C# 文件。
想法是进行测试 运行,在 TestRail 和 Ranorex 中进行测试,将这些测试的测试执行成功发布到 TestRail。
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());
这会将一个案例的结果发布到 Ranorex(因此 add_result_for_case 方法。运行ID 是我在执行套件时在命令行中提供的参数,Ranorex 中的每个测试用例对应于 TestRail 中的一个测试用例,并且必须包含测试用例 ID。
查看 http://docs.gurock.com/testrail-api2/start TestRail api 提供的可能性
任何人也曾使用 TestRail(可能通过单击按钮)在 Ranorex 中触发自动测试 运行,然后 return result/s 返回 testrail。
是否可以与我们分享您所做的步骤以及示例代码。
你能强调一下你是如何在 Ranorex 中 运行 多个测试用例的吗?
谢谢!
我已经使用 TestRails API binding for .NET (http://docs.gurock.com/testrail-api2/bindings-dotnet) 在 Ranorex 中编写了一个简单的 C# 文件。
想法是进行测试 运行,在 TestRail 和 Ranorex 中进行测试,将这些测试的测试执行成功发布到 TestRail。
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());
这会将一个案例的结果发布到 Ranorex(因此 add_result_for_case 方法。运行ID 是我在执行套件时在命令行中提供的参数,Ranorex 中的每个测试用例对应于 TestRail 中的一个测试用例,并且必须包含测试用例 ID。
查看 http://docs.gurock.com/testrail-api2/start TestRail api 提供的可能性