Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing `go test `自动测试的文件修改监控_Unit Testing_Go_Automated Tests - Fatal编程技术网

Unit testing `go test `自动测试的文件修改监控

Unit testing `go test `自动测试的文件修改监控,unit-testing,go,automated-tests,Unit Testing,Go,Automated Tests,是否有一种方法可以在项目的文件被修改时运行go test 也许有一个很好的通用解决方案,可以在修改路径中可用于此用途的文件时运行命令。您可以用于此用途。示例:在写入数据时,观察某个目录并在关闭时执行go test: inotifywait -e close_write <dir> | while read file; do go test; done 上面的命令将监视当前目录中的更改,并在发生更改时运行go test。大量选项。我将添加到这个组合中,因为它看起来简单、有效且易于使用

是否有一种方法可以在项目的文件被修改时运行
go test

也许有一个很好的通用解决方案,可以在修改路径中可用于此用途的文件时运行命令。

您可以用于此用途。示例:在写入数据时,观察某个目录并在关闭时执行
go test

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

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

大量选项。我将添加到这个组合中,因为它看起来简单、有效且易于使用。fsnotify很好(GoTransfer曾经使用过它),但我们遇到了“打开的文件太多”错误。如果你遇到了这个问题,你可以考虑一个这样的工具自动运行测试,你可以在浏览器中查看它们,并且不会一直打开所有的文件来观看它们。
rerun go test