![](/img/trans.png)
[英]Invalid on demand test run run id 0 error when running pipeline test
[英]Running test using Terratest but it throws “no test files” error
我正在為 Azure 中的 terraform 進行 terratest。 目前正在使用以下鏈接中給出的示例代碼- https://docs.microsoft.com/en-us/azure/developer/terraform/best-practices-end-to-end-testing 。
當我嘗試運行go test -v
它給出[無測試文件],不知道為什么。
任何人都可以幫忙嗎?
您需要確保當您在test
目錄中進行go test
時。 cd
進入測試目錄,然后運行命令
包含測試的文件應稱為 name_test,並帶有 _test 后綴。 他們應該在他們正在測試的代碼旁邊。
使用例如 go mod init azure 初始化 golang 模塊
要運行測試,請調用 go test -v./ -timeout 10m
從如何編寫 Go 代碼: https://golang.org/doc/code#Testing
注意:VS Code Go 擴展可以幫助您更好地解決語法問題。
此外,MS Docs 中提供的代碼已過時,因此您可能必須在驗證階段工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.