简体   繁体   English

IntelliJ的运行/调试配置中的变量

[英]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.

相关问题 Eclipse中IntelliJ IDEA的“启动前:”运行/调试配置功能等同于什么? - What's the equivalent of IntelliJ IDEA's Run/Debug Configurations “Before launch:” feature in Eclipse? 在IntelliJ JUnit运行配置中共享环境变量 - Sharing environment variables in IntelliJ JUnit run configurations IntelliJ IDEA在哪里保留运行/调试配置? - Where does IntelliJ IDEA keep run/debug configurations? IntelliJ 不会在运行/调试配置中将“应用程序”显示为选项 - IntelliJ does not show "Applications" as an option in Run/Debug Configurations 什么是在IntelliJ 2017.2“运行/调试配置”对话框中“在Tomcat实例中部署应用程序”? - What is “Deploy applications configured in Tomcat instance” in IntelliJ 2017.2 “Run/Debug Configurations” dialog? Intellij IDEA:使用一组环境变量运行/调试Java应用程序 - Intellij IDEA: run/debug java application with a set of environment variables intellij是否支持启动配置中的变量? - does intellij support variables in launch configurations? 运行和调试Intellij程序 - Run and Debug a program Intellij 在IntelliJ中运行/调试ElasticSearch - Run/Debug ElasticSearch in IntelliJ 在intellij运行配置中包括排除的jar - Including excluded jars in intellij run configurations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM