|
86 | 86 | When using Ginkgo, developers create tests for a particular module (say, the |
87 | 87 | `books` module) by creating a `books_test.go` file and calling some Ginkgo |
88 | 88 | functions in a BDD test style. A sample Ginkgo test might look something like |
89 | | -this ([`types_test.go`](examples/books/api/types_test.go.txt)): |
| 89 | +this: |
90 | 90 |
|
91 | 91 | ```go |
92 | 92 | package api_test |
@@ -141,9 +141,7 @@ var _ = Describe("Books API Types", func() { |
141 | 141 | This is perfectly fine for simple unit tests of Go code. However, once the |
142 | 142 | tests begin to call multiple APIs or packages, the Ginkgo Go tests start to get |
143 | 143 | cumbersome. Consider the following example of *functionally* testing the |
144 | | -failure modes for a simple HTTP REST API endpoint |
145 | | -([`failure_test.go`](https://github.com/gdt-dev/gdt-examples/blob/main/http/api/failure_test.go)): |
146 | | - |
| 144 | +failure modes for a simple HTTP REST API endpoint: |
147 | 145 |
|
148 | 146 | ```go |
149 | 147 | package api_test |
@@ -257,8 +255,7 @@ var _ = Describe("Books API - GET /books failures", func() { |
257 | 255 |
|
258 | 256 | The above test code obscures what is being tested by cluttering the test |
259 | 257 | assertions with the Go closures and accessor code. Compare the above with |
260 | | -how `gdt` allows the test author to describe the same assertions |
261 | | -([`failures.yaml`](https://github.com/gdt-dev/gdt-examples/blob/main/http/tests/api/failures.yaml)): |
| 258 | +how `gdt` allows the test author to describe the same assertions: |
262 | 259 |
|
263 | 260 | ```yaml |
264 | 261 | fixtures: |
@@ -300,8 +297,7 @@ Consider a Ginkgo test case that checks the following behaviour: |
300 | 297 | * The newly-created book's ID field is a valid UUID |
301 | 298 | * The newly-created book's publisher has an address containing a known state code |
302 | 299 |
|
303 | | -A typical implementation of a Ginkgo test might look like this |
304 | | -([`create_then_get_test.go`](https://github.com/gdt-dev/gdt-examples/blob/main/http/api/create_then_get_test.go)): |
| 300 | +A typical implementation of a Ginkgo test might look like this: |
305 | 301 |
|
306 | 302 | ```go |
307 | 303 | package api_test |
@@ -381,8 +377,7 @@ var _ = Describe("Books API - POST /books -> GET /books from Location", func() { |
381 | 377 | ``` |
382 | 378 |
|
383 | 379 | Compare the above test code to the following YAML document that a `gdt` user |
384 | | -might create to describe the same assertions |
385 | | -([`create_then_get.yaml`](https://github.com/gdt-dev/gdt-examples/blob/main/http/tests/api/create_then_get.yaml)): |
| 380 | +might create to describe the same assertions: |
386 | 381 |
|
387 | 382 | ```yaml |
388 | 383 | fixtures: |
@@ -432,7 +427,7 @@ All `gdt` scenarios have the following fields: |
432 | 427 | * `tests`: list of [`Spec`][basespec] specializations that represent the |
433 | 428 | runnable test units in the test scenario. |
434 | 429 |
|
435 | | -[basespec]: https://github.com/gdt-dev/gdt/blob/ecee17249e1fa10147cf9191be0358923da44094/types/spec.go#L30 |
| 430 | +[basespec]: https://github.com/gdt-dev/core/blob/023f92ee3468852d1d477df91cf42789e472b3b5/api/spec.go#L27-L48 |
436 | 431 |
|
437 | 432 | The scenario's `tests` field is the most important and the [`Spec`][basespec] |
438 | 433 | objects that it contains are the meat of a test scenario. |
@@ -490,10 +485,10 @@ All test specs have the following fields: |
490 | 485 | is used to execute the command and instead the operating system's `exec` family |
491 | 486 | of calls is used. |
492 | 487 |
|
493 | | -[exec-plugin]: https://github.com/gdt-dev/gdt/tree/ecee17249e1fa10147cf9191be0358923da44094/plugin/exec |
| 488 | +[exec-plugin]: https://github.com/gdt-dev/core/tree/023f92ee3468852d1d477df91cf42789e472b3b5/plugin/exec |
494 | 489 | [http-plugin]: https://github.com/gdt-dev/http |
495 | 490 | [kube-plugin]: https://github.com/gdt-dev/kube |
496 | | -[wait]: https://github.com/gdt-dev/gdt/blob/2791e11105fd3c36d1f11a7d111e089be7cdc84c/types/wait.go#L11-L25 |
| 491 | +[wait]: https://github.com/gdt-dev/core/blob/023f92ee3468852d1d477df91cf42789e472b3b5/api/wait.go#L11-L25 |
497 | 492 |
|
498 | 493 | #### `exec` test spec structure |
499 | 494 |
|
@@ -558,8 +553,8 @@ test spec also contains these fields: |
558 | 553 | * `assert.err.none`: (optional) a string or list of strings of which *none |
559 | 554 | should be present* in `stderr`. |
560 | 555 |
|
561 | | -[execspec]: https://github.com/gdt-dev/gdt/blob/2791e11105fd3c36d1f11a7d111e089be7cdc84c/exec/spec.go#L11-L34 |
562 | | -[pipeexpect]: https://github.com/gdt-dev/gdt/blob/2791e11105fd3c36d1f11a7d111e089be7cdc84c/exec/assertions.go#L15-L26 |
| 556 | +[execspec]: https://github.com/gdt-dev/core/blob/023f92ee3468852d1d477df91cf42789e472b3b5/plugin/exec/spec.go#L11-L24 |
| 557 | +[pipeexpect]: https://github.com/gdt-dev/core/blob/023f92ee3468852d1d477df91cf42789e472b3b5/plugin/exec/assertions.go#L30-L41 |
563 | 558 |
|
564 | 559 | ### Passing variables to subsequent test specs |
565 | 560 |
|
|
0 commit comments