IntelliJ 与黄瓜 (java) 和步骤定义位置 [英] IntelliJ with cucumber (java) and step definition location

查看:27
本文介绍了IntelliJ 与黄瓜 (java) 和步骤定义位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我正在使用 IntelliJ 开展一个项目,并试图利用其黄瓜功能.我没有使用过 Java 风格的黄瓜,但 IntelliJ 似乎希望步骤定义文件位于特定位置,相对于功能文件.

Ok, so I'm working on a project using IntelliJ and trying to take advantage of its cucumber functionality. I've not worked with the java flavour of cucumber, but IntelliJ seems to want the step definition files in a specific location, relative to the feature files.

我发现了这个:如何定义IntelliJ 12 中黄瓜的步骤定义位置 和其他来源指出我能够添加我的运行配置的胶水"属性,它告诉 cuke 哪个包可以找到步骤文件.所以我现在可以通过 IDEA 运行我的测试.但是我每次运行新测试时都需要设置它,因为 Ctrl+Alt+F10 或右键单击+运行测试不会用这个标志开始测试.此外,ide 支持被搞砸了,因为 IDEA 不知道步骤在哪里,它不会自动完成或 Ctrl+单击导航到步骤.

I found this: how to define step definitions location for cucumber in intelliJ 12 and other sources that pointed me to been able to add the "glue" property of my run configurations which tells cuke which package to find the step file. So I am at a point where I can run my tests via IDEA. BUT I need to set this every time I run a new test, as Ctrl+Alt+F10 or right click+run test will not start the test with this flag. Also, the ide support is screwed as IDEA doesn't know where the steps are, it doesn't auto complte or Ctrl+Click navigate to steps.

IDEA 项目有没有办法在运行测试和自动完成时始终在给定包中查找步骤?

Is there a way to the the IDEA project to always look for steps in a given package both when running the tests and for its auto complete?

推荐答案

为可能遇到此问题的其他人创建自己的答案.我的项目没有标记为测试源根目录的步骤,尽管我确实这样做了,但直到我关闭并重新打开我的项目时,它们才被选中.所以简单的重启是我的答案.

Creating self answer for others who might have this problem. My project did not have the steps marked as test source root, and although I DID do this, it was not until I closed and reopened my project that they were picked up. So a simple restart was my answer.

这篇关于IntelliJ 与黄瓜 (java) 和步骤定义位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆