【问题标题】:E2E Tests With SpringBoot Backend and Angular Frontend使用 SpringBoot 后端和 Angular 前端进行 E2E 测试
【发布时间】:2021-05-19 10:56:12
【问题描述】:

我正在开发一个有 2 个模块的应用程序。

  1. 服务器模块,即 SpringBoot。
  2. Angular中的ui

我无法为我的应用程序运行任何 E2E 测试,因为它在测试运行之前没有启动。我在测试类中定义了下面应该调出应用程序上下文的定义,但似乎没有。

@ContextConfiguration(classes=Application.class, loader = SpringBootContextLoader.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)

当我使用 IDE 中的运行按钮正常启动应用程序时,应用程序确实可以正常启动并在 localhost:8080 上正常运行。我不确定为什么在我尝试运行测试时应用程序没有出现。

是因为模块不同吗?

【问题讨论】:

    标签: angularjs spring-boot cucumber bdd


    【解决方案1】:

    问题不在于模块。有2个问题,

    1. 我使用旧版 Chrome 驱动程序运行测试。
    2. E2E 测试尝试使用 https 访问应用程序,但我使用的证书是自签名证书。为了克服这个问题,我在我的 chromeoptions 中添加了以下参数。

    chromeOptions.addArguments("allow-insecure-localhost");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-19
      • 2018-07-24
      • 2020-04-29
      • 2014-07-29
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多