【发布时间】:2020-08-06 17:47:14
【问题描述】:
我想知道我们如何测试自动化功能。
我正在开发一个使用 GemFire 缓存的 Spring Boot 微服务。现在我正在手动测试以下场景:
- 达到 TTL 后是否正确清除数据
- 如果对象存在,则从缓存中检索数据
所以,我知道我们可以有一个单独的服务来调用 GemFire 并确保对象存在于缓存中(用于第 2 步)。但不确定我们如何自动化步骤 1 的测试。
我想知道的重点是我们真的需要一个新服务来完全测试这个作为开销吗?是否有任何工具/更好的方法来测试功能?
【问题讨论】:
-
我附和 Juan 下面所说的;巨大的+1。为了添加更多细节,Spring Test for Apache Geode (STDG;github.com/spring-projects/spring-test-data-geode) 用于广泛测试 Spring Boot for Apache Geode (SBDG;github.com/spring-projects/spring-boot-data-geode ) 以及 Apache Geode 的 Spring Session (SSDG;github.com/spring-projects/spring-session-data-geode)。稍后,我将改造 Spring Data for Apache Geode (SDG;github.com/spring-projects/spring-data-geode) 测试套件以使用 STDG。 ...
-
注意:当我说 Apache Geode 时,我也指 VMware Tanzu GemFire。
-
现在,您可以随时查看 SBDG 测试套件中的单元和集成测试(例如 github.com/spring-projects/spring-boot-data-geode/tree/master/…)或 SSDG 测试套件(github.com/spring-projects/spring-session-data-geode/tree/…)中的测试,了解如何使用 STDG 的示例。我还鼓励您从 README (github.com/spring-projects/…) 开始了解 STDG。
-
最后,如果您想查看有关测试 GemFire/Geode 的到期(TTL 或 TTI)行为的测试,那么 SSDG 可能是您最好的选择,因为 SSDG 对 (HTTP) 会话的到期特别感兴趣,它使用 GemFire/Geode 的 TTI 过期功能以及自定义过期策略(通过
CustomExpiry)OOTB。例如,查看这些测试:github.com/spring-projects/spring-session-data-geode/tree/… -
SBDG 还添加了一个集成测试,以在 Spring Boot 上下文中使用 SSDG 测试 (HTTP) 会话的正确到期:github.com/spring-projects/spring-boot-data-geode/blob/master/…。 SBDG 为 SSDG 提供自动配置支持。
标签: spring-boot automated-tests integration-testing gemfire spring-data-gemfire