GO测试的差异测试范围之间的差异

发布于 2025-02-12 02:28:01 字数 607 浏览 1 评论 0原文

我打算在GO(使用Godog)和amp;我想出了以下命令进行测试的可能性。

有人可以指出这里的差异吗?推荐的方式是什么每个封面模式等的用例是什么?

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage.out -race

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage1.out -covermode=set

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage2.out -covermode=atomic

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage3.out

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage4.out

PS:为成为菜鸟而道歉:)

I am planning to run my Cucumber test in go (using Godog) & I came up with the following possibility of commands to run my tests.

Can someone point out the differences here? What is the recommended way & what's the use-case of each cover mode etc?

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage.out -race

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage1.out -covermode=set

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage2.out -covermode=atomic

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage3.out

go test -test.v -test.run ^TestFeatures$ -coverpkg=../... -coverprofile=coverage4.out

PS: Apologies for being a noob in GO :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下壹個目標 2025-02-19 02:28:01

这在GO博客上回答: https://go.dev/blog/cover#heat-heat-地图

  • set:每个语句是否运行?
  • 计数:每个语句运行了几次?
  • 原子:就像计数一样,但在平行程序中精确计数

This is answered on the GO blog: https://go.dev/blog/cover#heat-maps:

  • set: did each statement run?
  • count: how many times did each statement run?
  • atomic: like count, but counts precisely in parallel programs
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文