Robotframework 键盘中断清理

Robotframework Keyboard Interrupt cleanup

据我所知,文档建议发出 'Ctrl-C' 以中止“.robot”文件的执行(测试 case/suite)。我想知道是否有办法在发出此 'Ctrl-C' 时添加清理机制?如果没有,您能否建议我可以使用哪些机器人 api 库来增强?

如果您从控制台使用 control-c 停止执行,机器人仍将 运行 您的拆卸命令。

来自用户指南:

The execution is stopped when Ctrl-C is pressed in the console where the tests are running. ... By default teardowns of the tests and suites that have been started are executed even if the test execution is stopped using one of the methods above. This allows clean-up activities to be run regardless how execution ends.