【问题标题】:Sauce lab automatically log bug into jira酱实验室自动将错误记录到jira
【发布时间】:2022-01-22 22:28:12
【问题描述】:

我们正在研究自动化,所以我们面临的问题是酱实验室自动在 Jira 中记录失败测试用例的错误?

【问题讨论】:

    标签: automation automated-tests jira saucelabs


    【解决方案1】:

    是的,Sauce Labs 不仅记录失败的测试用例,我们还提供分析和仪表板来帮助您了解和发现这些失败的模式。您可以see an example here 了解如何添加传递给 Sauce Labs 仪表板的“测试状态”

    import org.junit.rules.TestRule;
    import org.junit.rules.TestWatcher;
    import org.junit.runner.Description;
    
    //...
    private String testName;
    private String sessionId;
    private SauceREST sauceClient;
    // ...
     @Override
            protected void before() throws Exception {
                if (host.equals("saucelabs")) {
                    MutableCapabilities sauceOptions = new MutableCapabilities();
                    sauceOptions.setCapability("username", sauceUser);
                    sauceOptions.setCapability("accessKey", sauceKey);
                    sauceOptions.setCapability("name", testName);
                    sauceOptions.setCapability("tunnelIdentifier", "walkerlj_tunnel_id" );
    //                sauceOptions.setCapability("parentTunnel", "walkerlj");
                    MutableCapabilities capabilities = new MutableCapabilities();
                    capabilities.setCapability("browserName", browserName);
                    capabilities.setCapability("browserVersion", browserVersion);
                    capabilities.setCapability("platformName", platformName);
                    capabilities.setCapability("sauce:options", sauceOptions);
                    String sauceUrl = String.format("https://ondemand.saucelabs.com/wd/hub");
                    driver = new RemoteWebDriver(new URL(sauceUrl), capabilities);
                    sessionId = ((RemoteWebDriver) driver).getSessionId().toString();
                    sauceClient = new SauceREST(sauceUser, sauceKey, DataCenter.US);
    
    // ...
      public TestRule watcher;{
        // ...
              @Override
              protected void failed(Throwable throwable, Description description) {
                  if (host.equals("saucelabs")) {
                      sauceClient.jobFailed(sessionId);
                      System.out.println(String.format("https://saucelabs.com/tests/%s", sessionId));
                  }
              }
    
              @Override
              protected void succeeded(Description description) {
                  if (host.equals("saucelabs")) {
                      sauceClient.jobPassed(sessionId);
                  }
              }
            };
    // ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-26
      • 1970-01-01
      • 2018-09-07
      • 2013-05-16
      • 2020-09-19
      • 2016-02-12
      • 2021-01-01
      • 1970-01-01
      相关资源
      最近更新 更多