【问题标题】:Trigger Automated Test from Testrail to Ranorex触发从 Testrail 到 Ranorex 的自动化测试
【发布时间】:2015-11-05 07:39:22
【问题描述】:

任何人也曾使用过 TestRail(可能通过单击按钮)在 Ranorex 中触发自动测试运行并将结果返回给 testrail。

能否与我们分享您所做的步骤以及示例代码。

您能否强调一下您如何在 Ranorex 中运行多个测试用例。

谢谢!

【问题讨论】:

    标签: ranorex testrail


    【解决方案1】:

    我已使用 TestRails API 绑定 .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 方法。runID 是我在执行套件和每个测试时在命令行中提供的参数Ranorex 中的 case 对应于 TestRail 中的一个测试用例,并且必须保存测试用例 id。

    看看http://docs.gurock.com/testrail-api2/start TestRail api 提供了哪些可能性

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-21
      • 2018-05-25
      • 2013-04-24
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      • 2019-09-30
      • 1970-01-01
      相关资源
      最近更新 更多