java8-cucumber-java8 sprinboot应用程序

问题描述 投票:0回答:1

我试图从java主应用程序运行.feature或者说一个Spring启动应用程序,而不是通过Junit方法。我正面临着从main运行它的问题。不知怎的,我试图通过在eclipse中使用Main.main调用从main运行但是当我打包到.jar或部署到openshift时它开始抛出没有后端模块发现异常。你们中的任何人都可以帮我找一个方法吗?我正在使用java8和cucumber-java8依赖

e.g

Main.main(new String[] { "-g", "com.test.helloworld", "C:\\Users\\<user.name>\\git1\\test-helloworld\\src\\main\\resources\\helloworld.feature" });

我想用普通的java主类来试试这个。在eclipse中,它能够毫无困难地执行,但是当我尝试使用jar / openshift时,它无法加载功能或后端模块。

cucumber-java
1个回答
1
投票

SpringBoot使用嵌套的jar结构,需要使用ApplicationContext.getResources来透明地访问它。因此,您必须为Cucumber实现一个利用应用程序上下文的资源加载器。

也可以看看:

© www.soinside.com 2019 - 2024. All rights reserved.