简体   繁体   English

如何使Cucumber-JVM与Gradle和Guice一起使用?

[英]How to get Cucumber-JVM to work with Gradle and Guice?

Cucumber-JVM and Gradle don't play along nicely. Cucumber-JVM和Gradle配合不好。 This is well known, and a workaround has existed for some time. 这是众所周知的,并且解决方法已经存在了一段时间。

However, I can't get said workaround to work with some more advanced tests using Guice as a DI container: Cucumber does not pick up the Guice module configured in the properties file, and maybe doesn't even pick up the file itself, causing singletons to be configured multiple times. 但是,对于使用Guice作为DI容器进行的一些更高级的测试,我不能说解决方法:Cucumber不会拾取属性文件中配置的Guice模块,甚至可能不会拾取文件本身,从而导致单例要配置多次。

My project conforms to standard layout ( src/test/java , src/test/resources ), with Cucumber's cucumber-guice.properties residing in the root of the resource folder. 我的项目符合标准布局( src/test/javasrc/test/resources ),黄瓜的cucumber-guice.properties居住在资源文件夹的根目录。 Inside my IDE of choice, IntelliJ IDEA, the tests run fine. 在我选择的IDE(IntelliJ IDEA)中,测试运行良好。

Do you know how to make this work? 你知道如何使这项工作吗?

我可以通过注解直接应用范围来解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM