我在执行单元测试后,所有方法都被测试,但唯独显示不出覆盖率,一下是信息:
➜ tests git:(develop) ✗ go test ./ -v -cover
=== RUN Test_GetUsers
--- PASS: Test_GetUsers (0.08s)
=== RUN Test_GetCurrentLocation
--- PASS: Test_GetCurrentLocation (0.01s)
=== RUN Test_CreateOrUpdateLocationArgs
--- PASS: Test_CreateOrUpdateLocationArgs (0.00s)
=== RUN Test_LocationCreateAndExists
--- PASS: Test_LocationCreateAndExists (0.07s)
=== RUN Test_Delete
--- PASS: Test_Delete (0.02s)
=== RUN Test_FindDashboard
--- PASS: Test_FindDashboard (0.01s)
=== RUN Test_FindServiceType
--- PASS: Test_FindServiceType (0.00s)
=== RUN Test_EditArgs
--- PASS: Test_EditArgs (0.00s)
=== RUN Test_SortArgs
--- PASS: Test_SortArgs (0.00s)
PASS
coverage: [no statements]
ok nimbus_backend/apisrv/tests (cached) coverage: [no statements]
大家看 coverage: no statements
但我查不到相关 no statements
的原因,所以在此求教, 我 go 的版本是 1.13 ubuntu 16.04,谢谢各位
You can also generate coverage profile using Cover tool
To analyze coverage via text prompt use
To analyze coverage via a browser, you can also use
Here are various options supported by Cover command
Given a coverage profile produced by ‘go test’:
Open a web browser displaying annotated source code:
Write out an HTML file instead of launching a web browser:
Display coverage percentages to stdout for each function: