cucumber-java - java8-cucumber-java8 sprinboot 应用程序
问题描述
我正在尝试从 java 主应用程序运行 .feature,或者说是一个 Spring Boot 应用程序,而不是通过 Junit 方法。我面临从 main 运行它的问题。不知何故,我试图通过在 Eclipse 中使用 Main.main 调用从 main 运行,但是当我打包到 .jar 或部署到 openshift 时,它开始抛出 No backend module found 异常。你们中的任何人都可以帮我找到解决方法吗?我正在使用 java8 和 cucumber-java8 依赖项
例如
Main.main(new String[] { "-g", "com.test.helloworld", "C:\\Users\\<user.name>\\git1\\test-helloworld\\src\\main\\resources\\helloworld.feature" });
我想用普通的java主类试试这个。在 Eclipse 中,它可以毫无困难地执行,但是当我尝试使用 jar/openshift 时,它无法加载功能或后端模块。
解决方案
SpringBoot 使用嵌套的 jar 结构,需要使用ApplicationContext.getResources
才能透明地访问它。因此,您必须为 Cucumber 实现一个利用应用程序上下文的资源加载器。
也可以看看:
推荐阅读
- c# - 如何连接 storageuri 和 SAS 令牌以及如何使用 c# 使用连接的 storageuri 和 SAS 令牌上传 blob?
- coq - 你如何告诉 CoqIde 我想使用苹果键盘“命令”来导航证明?
- python - 地址范围的 Pythonic 数据清理
- hugo - Hugo - 页面包中的相对路径
- d3.js - 使用 D3 v5 和 TopoJson2 的美国邮政编码的 Chloropleth
- php - Ajax 搜索插件高级字段
- c# - Unity - 动画 - 动画不向左/向右翻转
- python - Ansible 过滤器 stdout_lines 剪切或拆分
- weblog - Web 服务器日志数据中的最后一个字段是关于什么的?
- java - 如何“交换”数组中的两个值?