创建测试套件 $ mkdir books $ cd books/ $ ginkgo bootstrap Generating ginkgo test suite bootstrap for books "github.com/onsi/ginkgo" . /gomega go: found github.com/onsi/ginkgo in github.com/onsi/ginkgo v1.14.2 go: found github.com/onsi/ 添加测试用例 $ ginkgo generate book Generating ginkgo test for Book in: book_test.go $ cat book_test.go "github.com/onsi/ginkgo" .
Ginkgo Ginkgo是一个 Go 语言的 BDD 测试框架,旨在帮助开发者编写富有表现力的全方位测试。Ginkgo 集成了 Go 原生的库,这意味着你可以通过来运行 Ginkgo 测试套件。 但 Ginkgo 建议的是搭配gomega库一起使用。 安装Ginkgo go get github.com/onsi/ginkgo/ginkgo go get github.com/onsi/gomega/... 2. “github.com/onsi/ginkgo/extensions/table” . "github.com/onsi/ginkgo" . 其仓库位于 https://github.com/onsi/ginkgo ,同时提供了英文版与中文版使用文档,读者可以借此了解更多 Ginkgo 信息。
一、Ginkgo包的引入和简单介绍 $ go get github.com/onsi/ginkgo/v2/ginkgo $ go get github.com/onsi/gomega 第一条命令是获取 ginkgo 并且安装 ginkgo 可执行文件到 GOPATH/bin –- 你需要在你电脑中把 GOPATH 配置上,并配置上它。 这同时意味着 Ginkgo 测试可以和传统 Go testing 测试一起使用。go test 和 ginkgo 都会运行你套件内的所有测试。 "github.com/onsi/ginkgo" . 这是 Ginkgo 和 Gomega 之间的唯一连接点 RegisterFailHandler(Fail) // 通知 Ginkgo 启动测试套件。
Test Suite ginkgo gomega $ go get github.com/onsi/ginkgo/ginkgo $ go get github.com/onsi/gomega $ ginkgo bootstrap Generating ginkgo test suite bootstrap for main in: go_microservice_suite_test.go package main_test //go_microservice_suite_test.go,单元测试类 import ( "github.com/onsi/ginkgo" "github.com /ginkgo RUN go get github.com/onsi/gomega //将整个目录拷贝到容器 ADD . 由于容器本地并没有一个Redis实例运行在上面,这时运行ginkgo测试就会报错。我们为什么不在这个Dockerfile中包含一个Redis呢?
cmd/genman cmd/genyaml cmd/genswaggertypedocs cmd/linkcheck vendor/github.com/onsi/ginkgo /ginkgo test/e2e/e2e.test cmd/kubemark vendor/github.com/onsi/ginkgo/ginkgo test/e2e_node bin [root@golang bin]# ls apiextensions-apiserver deepcopy-gen e2e.test genman ginkgo
这里说一些比较值得注意的内容: Migrate Ginkgo from v1 to v2 · kubernetes/kubernetes 这个 PR 持续了将近三个月,主要是将 Kubernetes 项目中使用的 Ginkgo 从已经废弃的 v1 版本升级到 v2 版本。 其实目前很多项目都在积极的推进此事,但不同的项目对 Ginkgo 的依赖和使用程度不同,在这个 PR 中修改了超过 600 个文件,非常的庞大。 而之前在 Apache APISIX Ingress controller 项目中,从 Ginkgo v1 升级到 v2 时,仅仅用了一周时间,修改文件不算太多。
cmd/genman cmd/genyaml cmd/genswaggertypedocs cmd/linkcheck vendor/github.com/onsi/ginkgo /ginkgo test/e2e/e2e.test cmd/kubemark vendor/github.com/onsi/ginkgo/ginkgo test/e2e_node cmd/genman cmd/genyaml cmd/genswaggertypedocs cmd/linkcheck vendor/github.com/onsi/ginkgo /ginkgo test/e2e/e2e.test +++ [0716 00:42:45] Building go targets for linux/amd64: cmd/kubemark vendor/github.com/onsi/ginkgo/ginkgo test/e2e_node/e2e_node.test +++ [0716 00:43:39] Syncing
genyaml kube-controller-manager kubemark defaulter-gen ginkgo make执行的指令是 all: generated_files hack/make-rules/build.sh $(WHAT) Makefile还有一些其他指令可以自行研究: ginkgo : hack/make-rules/build.sh vendor/github.com/onsi/ginkgo/ginkgo verify: KUBE_VERIFY_GIT_BRANCH test-integration: generated_files hack/make-rules/test-integration.sh $(WHAT) test-e2e-node: ginkgo
如果已经升级了,那么可以自行增加此参数; Migrate Ginkgo from v1 to v2 · kubernetes/kubernetes 这个 PR 持续了将近三个月,主要是将 Kubernetes 项目中使用的 Ginkgo 从已经废弃的 v1 版本升级到 v2 版本。 其实目前很多项目都在积极的推进此事,但不同的项目对 Ginkgo 的依赖和使用程度不同,在这个 PR 中修改了超过 600 个文件,非常的庞大。 而之前在 Apache APISIX Ingress controller 项目中,从 Ginkgo v1 升级到 v2 时,仅仅用了一周时间,修改文件不算太多。
genkubedocs cmd/genman cmd/genyaml cmd/genswaggertypedocs cmd/linkcheck vendor/github.com/onsi/ginkgo /ginkgo test/e2e/e2e.test cmd/kubemark vendor/github.com/onsi/ginkgo/ginkgo test/e2e_node genswaggertypedocs-rwxr-xr-x 1 root root 62312802 Apr 25 17:43 genyaml-rwxr-xr-x 1 root root 12754284 Apr 25 17:43 ginkgo-rwxr-xr-x
) * [Go-Underscore](https://github.com/ahl5esoft/golang-underscore) 测试 单元、行为和集成测试 GoMock Testify GinkGo
12、测试 1)单元,行为,集成测试 GoMock:https://github.com/golang/mock Testify:https://github.com/stretchr/testify GinkGo :https://github.com/onsi/ginkgo GoMega:https://github.com/onsi/gomega GoCheck:https://github.com/go-check
浏览器集成测试 agouti 官网上的例子推荐使用 agouti + Ginkgo + Gomega 的组合,本着用的工具越简单,工具本身带来 bug 机率越小的原则, 试验了一下, 最后选择了 agouti + Gomega 的组合, 主要是看中了 Gomega 提供的 one line assertion, 而 Ginkgo 的描述式 DSL 就没什么吸引力了。
LinuxSuRen 优化 jcli 的开发版 docker 镜像,使得更小 (#268) @LinuxSuRen 增加拉取镜像数量的徽章 (#261) @LinuxSuRen 把 github.com/onsi/ginkgo
Vaire 表示,Ginkgo Bioworks 创始人、现代可逆计算先驱 Tom Knight 是种子轮融资者之一。
Gingko Ginkgo是一个 Go 测试框架,目的是帮助我们使用行为驱动开发(“BDD”)风格高效地编写富有表现力和全面的测试。它有着非常良好的帮助文档,任何人都可以轻松地在项目中集成使用它。
我们根据代码可以得到,我们需要传入Ginkgo参数,其值需要经过base64进行加密,后端进行解码通过eval函数执行,所以我们可以传入base64编码后的一句话作为ginkgo的值。
github.com/AlecAivazis/survey/v2 from 2.0.8 to 2.2.2 (#445 #459) @dependabot-preview Bump github.com/onsi/ginkgo
graphql-go 最好知道 Validator Glow GJson Authboss Go-Underscore 测试 单元、行为和集成测试 GoMock Testify GinkGo
基因工程 Ginkgo Bioworks 微生物科技初创公司Ginkgo Bioworks获得2.75亿美元D轮融资,投资方包括Viking Global、知名创业孵化器YC旗下Continuity Ginkgo Bioworks是美国一家微生物科技定制服务商,公司主要通过基因改造以及定制微生物的方式合成气味,并制作香精。