AWS CodeBuild-如果junit5 beforeall未经治疗的例外,如何显示错误测试类?

发布于 2025-01-29 20:38:29 字数 1026 浏览 4 评论 0原文

如果junit5 beforeall如下所示,那么AWS代码构建将无法显示故障测试类。

class ApiImplTest {
  @BeforeAll
  public static void beforeClass() {
    ...
    throw new RuntimeException("Dummy test error");
  }

  @Test
  void testApi() {
    ...
  }
}

AWS代码构建报告如下所示,如

”在此处输入映像说明“

surefire XML报告显示的错误如下,

  <testcase name="" classname="com.master.apis.analytics.ApiImplTest" time="0.002">
    <error type="java.lang.RuntimeException"><![CDATA[java.lang.RuntimeException: Dummy test error
        at com.master.apis.analytics.ApiImplTest.beforeClass(ApiImplTest.java:46)
]]></error>

我想是由于testcase name =“”在上面的XML报告中。

有人可以让我知道有没有办法在AWS代码构建测试报告中显示失败的测试类名称?

  • Maven Surefire -3.0.0 -m5
  • OpenJDK 11
  • Junit -Jupiter -5.6.3

If there is an unhandled exception from JUnit5 BeforeAll like below then AWS Code Build is not able to show the failure test classes.

class ApiImplTest {
  @BeforeAll
  public static void beforeClass() {
    ...
    throw new RuntimeException("Dummy test error");
  }

  @Test
  void testApi() {
    ...
  }
}

AWS Code Build Report is showing like below

enter image description here

surefire xml report is showing the error like below

  <testcase name="" classname="com.master.apis.analytics.ApiImplTest" time="0.002">
    <error type="java.lang.RuntimeException"><![CDATA[java.lang.RuntimeException: Dummy test error
        at com.master.apis.analytics.ApiImplTest.beforeClass(ApiImplTest.java:46)
]]></error>

I guess it is due to the testcase name="" in the above xml report.

Can someone let me know is there a way to show the failed test class name in the AWS Code Build test report?

  • Maven Surefire - 3.0.0-M5
  • OpenJDK 11
  • Junit-Jupiter - 5.6.3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文