如何配置PyCharm自动并持续运行我的单元测试?

时间:2022-03-02 07:31:42

I would like to have some background unit tests run automatically continuously.

我希望一些后台单元测试能够持续地自动运行。

Can this be done in PyCharm ?

在PyCharm可以这样做吗?

1 个解决方案

#1


22  

This is very simple. Once you have created a run configuration for the unit tests, run them once manually. With the Run dialog open you will notice on the left hand size there are a group of icons arranged vertically. In that group is an icon with a circular arrow. Click that for the auto-run you seek. It behaves smartly. It doesn't just run continuously, but rather waits for you to make some changes in the code and for your to quiesce for a few seconds. At that point it appears you would be done with a change and the auto-repeat fires.

这是非常简单的。一旦您为单元测试创建了一个运行配置,那么手动地运行它们一次。打开运行对话框时,您将注意到在左手大小上有一组垂直排列的图标。在这个组中是一个带有圆形箭头的图标。单击该自动运行您寻找。它巧妙的行为方式。它不只是连续运行,而是等待您在代码中做出一些更改,并让您在几秒钟内停顿。此时,看起来您将完成一个更改并自动重复触发。

如何配置PyCharm自动并持续运行我的单元测试?

Please also see https://www.jetbrains.com/pycharm/help/rerunning-tests.html for some other great tips, such as only running failed tests.

还请参阅https://www.jetbrains.com/pycharm/help/rerunning-tests.html,了解一些其他很棒的技巧,比如只运行失败的测试。

#1


22  

This is very simple. Once you have created a run configuration for the unit tests, run them once manually. With the Run dialog open you will notice on the left hand size there are a group of icons arranged vertically. In that group is an icon with a circular arrow. Click that for the auto-run you seek. It behaves smartly. It doesn't just run continuously, but rather waits for you to make some changes in the code and for your to quiesce for a few seconds. At that point it appears you would be done with a change and the auto-repeat fires.

这是非常简单的。一旦您为单元测试创建了一个运行配置,那么手动地运行它们一次。打开运行对话框时,您将注意到在左手大小上有一组垂直排列的图标。在这个组中是一个带有圆形箭头的图标。单击该自动运行您寻找。它巧妙的行为方式。它不只是连续运行,而是等待您在代码中做出一些更改,并让您在几秒钟内停顿。此时,看起来您将完成一个更改并自动重复触发。

如何配置PyCharm自动并持续运行我的单元测试?

Please also see https://www.jetbrains.com/pycharm/help/rerunning-tests.html for some other great tips, such as only running failed tests.

还请参阅https://www.jetbrains.com/pycharm/help/rerunning-tests.html,了解一些其他很棒的技巧,比如只运行失败的测试。