`go test`文件修改监控自动化测试

时间:2013-11-22 00:22:08

标签: unit-testing go automated-tests

是否可以在修改项目文件时运行go test

当修改路径中的文件可用于此用途时,运行命令可能有一个很好的通用解决方案吗?

1 个答案:

答案 0 :(得分:2)

您可以使用inotifywait。在写入数据的同时观看某个目录并在关闭时执行go test的示例:

inotifywait -e close_write <dir> | while read file; do go test; done

或者您使用howeyc/fsnotify包编写自己的工具:Similar example application

还有rerun,用ruby编写:

rerun go test

上面的命令将监视当前目录的更改,并在发生更改时运行go test

相关问题