gpt4 book ai didi

go - 如何使用银杏在多个测试文件中编写测试用例?

转载 作者:数据小太阳 更新时间:2023-10-29 03:23:23 25 4
gpt4 key购买 nike

如何使用ginkgo在多个测试文件中编写测试用例?

a_suite_test.go 文件:

func TestA(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "A Suite")
}

a_test.go:

var _ = Describe("A", func() {
Context("A", func() {
It("A", func() {
Expect(1).To(Equal(1))
})
})
})

我运行 ginkgo,但抛出错误:

Failed to compile A:

go build xxx: no non-test Go files in xxx

我可以在其他测试文件中编写测试用例而不是在套件测试文件中编写吗?

最佳答案

运行

go test ./...

从项目的根目录开始,它将运行所有测试。使用 ginkgo 你需要这个套件文件,但是 go test 命令会抓取它并运行它。

关于go - 如何使用银杏在多个测试文件中编写测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49024373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com