【问题标题】:How to integrate Galen reports in Jenkins如何在 Jenkins 中集成 Galen 报告
【发布时间】:2015-03-19 17:47:28
【问题描述】:

我已经开始使用 Galen 框架来测试我的网站页面的布局,并且我还有其他测试,用 Selenium 编写,并集成到 Jenkins 中。 我正在使用 Java+JUnit+Maven,我想知道是否有人设法将 Galen 报告集成到 Jenkins 中以及如何。 因为目前我正在使用类似的东西:

assertThat(layoutReport.errors(), is(0));

告诉我测试中是否有错误,但不告诉我在哪里。 谢谢!

附:如果有声誉的人可以制作标签 galen-framework 以便我们可以对这些类型的问题进行分组,那就太好了:D

【问题讨论】:

    标签: selenium jenkins galen


    【解决方案1】:

    在您的情况下,您可以使用 Galen 生成 HTML 报告,就像使用它运行测试时通常所做的那样。尽管您必须管理 GalenTestInfo 对象的创建。 以下是 HTML 报告生成的工作原理。想象一下,您在某处定义了 obtainAllTests 方法,该方法返回所有已执行测试的列表。

    List<GalenTestInfo> tests = obtainAllTests();
    new HtmlReportBuilder().build(tests, "target/galen-html-reports");
    

    您可以在代码中的某个位置创建GalenTestInfo 并将其添加到某个集合中:

     GalenTestInfo testInfo = GalenTestInfo.fromString("Here goes the name of your test");
    

    完成布局检查并获得LayoutReport 对象后,您可以将此报告添加到测试报告中。以下是你可以做到的:

     LayoutReport layoutReport = Galen.checkLayout(driver, 
          specPath, includedTags, null, 
          new Properties(), null);
    
     testInfo.getReport().layout(layoutReport, "A title for your layout check");
    

    您可以在此项目https://github.com/galenframework/galen-sample-java-tests 中找到更多见解。它为 Java + TestNG + Maven 中的 Galen 测试提供了基本设置。其中的报告收集在一个单独的GalenReportsContainer 中。在GalenReportingListener 中还实现了一个报告器,它从GalenReportsContainer 获取所有这些测试并生成 HTML 报告。

    【讨论】:

      【解决方案2】:

      您可以在此处查看 Java(TestNG 和 JUnit)和 JavaScript 的完整示例: https://github.com/hypery2k/galen_samples.

      我将HTML Plugin 与 Jenkins 一起使用,参见示例here

      【讨论】:

      • 示例链接失效。能更新一下吗?
      猜你喜欢
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多