简体   繁体   English

仅当IntelliJ Idea中存在错误时,如何显示运行工具?

[英]How to show run tool only when there is an error in IntelliJ Idea?

I use TDD quite a lot, and I was wondering if there is a way to show the Run Tool window only when there are failed tests? 我使用TDD的次数很多,我想知道是否只有在测试失败的情况下才可以显示“运行工具”窗口?

Or to be more generic, for any run configuration, I would like the Run Tool window to be shown only when something goes wrong. 或更笼统地说,对于任何运行配置,我希望仅在出现问题时才显示“运行工具”窗口。 Otherwise I would prefer the little non-obtrusive green pop-up to appear. 否则,我希望出现一点不引人注目的绿色弹出窗口。 Like when you run a lot of tests and you minimize the Run Tool by clicking on the "down arrow" in its top-right corner. 就像您运行大量测试时一样,您可以通过单击右上角的“向下箭头”来最小化运行工具。 When the tests are done, a little green pop-up appears over the minimized window. 测试完成后,最小化窗口上方会出现一个绿色的弹出窗口。

I would also compromise for an answer that tells me how to keep the Run Tool always minimized, and only see little pop-ups, regardless if they are green or red. 我还会妥协一个答案,该答案告诉我如何使运行工具始终保持最小化,并且仅看到很少的弹出窗口,无论它们是绿色还是红色。

This is probably not exactly the answer you wanted but if you look in the RunConfiguration (Run->Edit Configurations -> JUnit) for your test run you should see a checkbox called 'Activate tool window'. 这可能不完全是您想要的答案,但是如果您在RunConfiguration(运行->编辑配置-> JUnit)中进行测试运行,则应该看到一个名为“激活工具窗口”的复选框。 If that box is ticked then the Run Tool window will pop open even if its minimised. 如果选中该框,则即使最小化了“运行工具”窗口,它也会弹出打开。 When it's not ticked then the Run Tool window will stay minimised. 如果未勾选,则“运行工具”窗口将保持最小化。

So, for any individual existing test run you can change the check box value to prevent the tool window appearing. 因此,对于任何单个现有的测试运行,您都可以更改复选框值以防止出现工具窗口。 If you're doing TDD that could mean you have many configurations for specific test cases / suites etc, which you would need to change individually. 如果您正在执行TDD,则可能意味着您有许多针对特定测试用例/套件等的配置,需要分别进行更改。

In the longer term, you probably want to avoid future run configurations popping up the test. 从长远来看,您可能希望避免将来的运行配置弹出测试。 You can do that through the Defaults -> JUnit section in the RunConfigurations window. 您可以通过RunConfigurations窗口中的Defaults-> JUnit部分执行此操作。

Also, in the tab "Logs" you can check the option "Show console when a message is printed to standard error stream" 另外,在“日志”选项卡中,您可以选中“将消息打印到标准错误流时显示控制台”选项

When this option is checked the window is opened automatically if some test fails. 选中此选项后,如果某些测试失败,则会自动打开窗口。

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

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