[英]Variables in IntelliJ's Run/Debug Configurations
I am wanting to set up a Run/Debug Configuration in IntelliJ for JUnit. 我想在IntelliJ中为JUnit设置运行/调试配置。 I know how to set it up to run a specific
package
, a specific class
, or a specific method
. 我知道如何设置它以运行特定的
package
,特定的class
或特定的method
。 I was wondering if there was a way to set up the configurations so it will run the currently opened Class
file or the currently selected test method
. 我想知道是否有一种方法可以设置配置,以便它将运行当前打开的
Class
文件或当前选择的测试method
。 I would imagine I would put something like this in the Class
field of the Run/Debug Configurations
dialog box: 我想我会在“
Run/Debug Configurations
对话框的Run/Debug Configurations
Class
字段中输入以下内容:
my.package.tests.${currentTest}
or something like that. 或类似的东西。 Is there a way to accomplish this so I don't have to make a Run/Debug Configuration for each test class I want to run?
有没有一种方法可以做到这一点,所以我不必为要运行的每个测试类都进行“运行/调试”配置?
If you need specific settings for all you tests you can change the defaults eg add -ea. 如果您需要所有测试的特定设置,则可以更改默认值,例如添加-ea。 This way you don't need a configuration for each test.
这样,您不需要为每个测试进行配置。
BTW: YoU can run all the tests in a package, by selecting the package first. 顺便说一句:您可以先选择软件包,然后运行软件包中的所有测试。 Sometimes it is better to run a group of tests to check you haven't changed something unintended.
有时最好运行一组测试来检查您是否没有意外更改。
You can either use the right-click > "run testYourtest()" or the shortcut define in the keymap as "Run context configuration". 您可以使用右键单击>“ run testYourtest()”,也可以在键盘图中将快捷方式定义为“运行上下文配置”。
Usually it's ctrl + shift + F10 . 通常是ctrl + shift + F10 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.