diff --git a/scaling-acceptance-tests.md b/scaling-acceptance-tests.md index e32ae20ce..7ecbb467c 100644 --- a/scaling-acceptance-tests.md +++ b/scaling-acceptance-tests.md @@ -65,7 +65,7 @@ As software engineers, we have to deal with two kinds of complexity. - **Accidental complexity** is the complexity we have to deal with because we're working with computers, stuff like networks, disks, APIs, etc. - **Essential complexity** is sometimes referred to as "domain logic". It's the particular rules and truths within your domain. - - For example, "if an account owner withdraws more money than is available, they are overdrawn". This statement says nothing about computers; this statement was true before computers were even used in banks! + - For example, "if an account owner withdraws more money than is available, they are overdrawn". This statement says nothing about computers; this statement was true before computers were even used in banks! Essential complexity should be expressible to a non-technical person, and it's valuable to have modelled it in our "domain" code, and in our acceptance tests. @@ -157,7 +157,7 @@ This is waste. ## Enough talk, time to code -Unlike other chapters, you'll need [Docker](https://www.docker.com) installed because we'll be running our applications in containers. +Unlike other chapters, you'll need [Docker](https://www.docker.com) installed because we'll be running our applications in containers. It's assumed at this point in the book you're comfortable writing Go code, importing from different packages, etc. Create a new project with `go mod init github.com/quii/go-specs-greet` (you can put whatever you like here but if you change the path you will need to change all internal imports to match) @@ -282,17 +282,6 @@ func (d Driver) Greet() (string, error) { } ``` -Import the driver into `greeter_server_test.go` by adjusting the `import` section as follows: - -```go -import ( - "testing" - - "gitlab.com/quii/go-specs-greet/specifications" - go_specs_greet "gitlab.com/quii/go-specs-greet" -) -``` - Notes: @@ -1563,5 +1552,6 @@ Specifications should then double up as documentation. They should specify clear - In this example, our "DSL" is not much of a DSL; we just used interfaces to decouple our specification from the real world and allow us to express domain logic cleanly. As your system grows, this level of abstraction might become clumsy and unclear. [Read into the "Screenplay Pattern"](https://cucumber.io/blog/bdd/understanding-screenplay-(part-1)/) if you want to find more ideas as to how to structure your specifications. - For emphasis, [Growing Object-Oriented Software, Guided by Tests,](http://www.growing-object-oriented-software.com) is a classic. It demonstrates applying this "London style", "top-down" approach to writing software. Anyone who has enjoyed Learn Go with Tests should get much value from reading GOOS. - [In the example code repository](https://github.com/quii/go-specs-greet), there's more code and ideas I haven't written about here, such as multi-stage docker build, you may wish to check this out. - - In particular, *for fun*, I made a **third program**, a website with some HTML forms to `Greet` and `Curse`. The `Driver` leverages the excellent-looking [https://github.com/go-rod/rod](https://github.com/go-rod/rod) module, which allows it to work with the website with a browser, just like a user would. Looking at the git history, you can see how I started not using any templating tools "just to make it work" Then, once I passed my acceptance test, I had the freedom to do so without fear of breaking things. + - In particular, *for fun*, I made a **third program**, a website with some HTML forms to `Greet` and `Curse`. The `Driver` leverages the excellent-looking [https://github.com/go-rod/rod](https://github.com/go-rod/rod) module, which allows it to work with the website with a browser, just like a user would. Looking at the git history, you can see how I started not using any templating tools "just to make it work" Then, once I passed my acceptance test, I had the freedom to do so without fear of breaking things. +