如何在Intellij IDEA中更改默认测试框架? [英] How to change default test framework in Intellij IDEA?
问题描述
情况如下:
我已经成功地在IntellijIDEA
和JUnit
中创建了测试.
然后,当我右键单击测试文件夹以运行测试时,我不小心选择了TestNG
而不是JUnit
.现在,当我尝试通过右键单击"tests"文件夹并单击运行所有测试"来运行测试时,它将尝试在TestNG
中运行它们,但是没有为TestNG
配置测试,这就是我拥有
Situation is the following:
I've succesfully created tests in IntellijIDEA
with JUnit
.
Then when I rightclick on test folder to run tests I accidentally have chosen TestNG
instead of JUnit
. Now when I try to run tests by right click on tests folder and clicking Run"All tests" it tries to run them in TestNG
, but tests are not configured for TestNG
that's why I have
测试框架意外退出,软件包中未找到测试错误
Test framework quit unexpectedly, No tests found in the package error
我在互联网上进行了搜索,但默认情况下未找到有关如何更改测试框架的任何信息. 有人可以帮忙吗?
I searched through the internet, but didn't find anything on how to change testing framework by default. Can anyone help?
推荐答案
只需在项目的运行配置"对话框中删除自动创建的TestNG运行/调试配置(运行" |编辑配置..."操作).然后,您将再次具有选择测试框架的选项.
Just delete the automatically created TestNG Run/Debug Configuration (Run | Edit Configurations... action) in Run Configurations dialog for the project. Then you will again have the option to choose test framework.
UPD::自2017.3版本以来,您可以设置suggest.all.run.configurations.from.context
属性(
UPD: Since 2017.3 version there is suggest.all.run.configurations.from.context
property which you can set (Help | Edit Custom Properties action) to true, then IDE will show you all the configurations that are available for current context.
这篇关于如何在Intellij IDEA中更改默认测试框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!