All Projects → quii → Learn Go With Tests

quii / Learn Go With Tests

Licence: mit
Learn Go with test-driven development

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Learn Go With Tests

Jgiven
Behavior-Driven Development in plain Java
Stars: ✭ 319 (-98.01%)
Mutual labels:  tdd, test-driven-development
Aruba
Test command-line applications with Cucumber-Ruby, RSpec or Minitest. The most up to date documentation can be found on Cucumber.Pro (https://app.cucumber.pro/projects/aruba)
Stars: ✭ 900 (-94.39%)
Mutual labels:  tdd, test-driven-development
Bash unit
bash unit testing enterprise edition framework for professionals
Stars: ✭ 419 (-97.39%)
Mutual labels:  tdd, test-driven-development
bdd-for-c
A simple BDD library for the C language
Stars: ✭ 90 (-99.44%)
Mutual labels:  tdd, test-driven-development
Ddd Tdd Rich Domain Model Dojo Kata
DDD patterns implemented following TDD
Stars: ✭ 91 (-99.43%)
Mutual labels:  tdd, test-driven-development
Awesome Unit Testing Swift
A curated collection of awesome blog articles, books, talks, podcasts, tools/frameworks and examples.
Stars: ✭ 272 (-98.31%)
Mutual labels:  tdd, test-driven-development
Quixote
CSS unit and integration testing
Stars: ✭ 788 (-95.09%)
Mutual labels:  tdd, test-driven-development
utest
Lightweight unit testing framework for C/C++ projects. Suitable for embedded devices.
Stars: ✭ 18 (-99.89%)
Mutual labels:  tdd, test-driven-development
Sinon
Test spies, stubs and mocks for JavaScript.
Stars: ✭ 8,828 (-45.02%)
Mutual labels:  tdd, test-driven-development
Moka
A Go mocking framework.
Stars: ✭ 53 (-99.67%)
Mutual labels:  tdd, test-driven-development
TddCourse
Kod źródłowy do kursu TDD na blogu dariuszwozniak.NET.
Stars: ✭ 18 (-99.89%)
Mutual labels:  tdd, test-driven-development
Nunit
NUnit 3 Framework
Stars: ✭ 2,131 (-86.73%)
Mutual labels:  tdd, test-driven-development
flake8-aaa
A Flake8 plugin that checks Python tests follow the Arrange-Act-Assert pattern
Stars: ✭ 51 (-99.68%)
Mutual labels:  tdd, test-driven-development
List Of Testing Tools And Frameworks For .net
✅ List of Automated Testing (TDD/BDD/ATDD/SBE) Tools and Frameworks for .NET
Stars: ✭ 303 (-98.11%)
Mutual labels:  tdd, test-driven-development
baserepo
Base repository
Stars: ✭ 71 (-99.56%)
Mutual labels:  tdd, test-driven-development
Entitas Csharp
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
Stars: ✭ 5,393 (-66.41%)
Mutual labels:  tdd, test-driven-development
Bandit
Human-friendly unit testing for C++11
Stars: ✭ 240 (-98.51%)
Mutual labels:  tdd, test-driven-development
PixelTest
Fast, modern, simple iOS snapshot testing written purely in Swift.
Stars: ✭ 56 (-99.65%)
Mutual labels:  tdd, test-driven-development
Executor
Watch for file changes and then execute command. Very nice for test driven development.
Stars: ✭ 14 (-99.91%)
Mutual labels:  tdd, test-driven-development
Laracom
Laravel FREE E-Commerce Software
Stars: ✭ 1,570 (-90.22%)
Mutual labels:  tdd, test-driven-development

Learn Go with Tests

Art by Denise

Go Report Card

Formats

Translations

Support me

I am proud to offer this resource for free, but if you wish to give some appreciation:

Why

Table of contents

Go fundamentals

  1. Install Go - Set up environment for productivity.
  2. Hello, world - Declaring variables, constants, if/else statements, switch, write your first go program and write your first test. Sub-test syntax and closures.
  3. Integers - Further Explore function declaration syntax and learn new ways to improve the documentation of your code.
  4. Iteration - Learn about for and benchmarking.
  5. Arrays and slices - Learn about arrays, slices, len, varargs, range and test coverage.
  6. Structs, methods & interfaces - Learn about struct, methods, interface and table driven tests.
  7. Pointers & errors - Learn about pointers and errors.
  8. Maps - Learn about storing values in the map data structure.
  9. Dependency Injection - Learn about dependency injection, how it relates to using interfaces and a primer on io.
  10. Mocking - Take some existing untested code and use DI with mocking to test it.
  11. Concurrency - Learn how to write concurrent code to make your software faster.
  12. Select - Learn how to synchronise asynchronous processes elegantly.
  13. Reflection - Learn about reflection
  14. Sync - Learn some functionality from the sync package including WaitGroup and Mutex
  15. Context - Use the context package to manage and cancel long-running processes
  16. Intro to property based tests - Practice some TDD with the Roman Numerals kata and get a brief intro to property based tests
  17. Maths - Use the math package to draw an SVG clock
  18. Reading files - Read files and process them

Build an application

Now that you have hopefully digested the Go Fundamentals section you have a solid grounding of a majority of Go's language features and how to do TDD.

This next section will involve building an application.

Each chapter will iterate on the previous one, expanding the application's functionality as our product owner dictates.

New concepts will be introduced to help facilitate writing great code but most of the new material will be learning what can be accomplished from Go's standard library.

By the end of this, you should have a strong grasp as to how to iteratively write an application in Go, backed by tests.

  • HTTP server - We will create an application which listens to HTTP requests and responds to them.
  • JSON, routing and embedding - We will make our endpoints return JSON and explore how to do routing.
  • IO and sorting - We will persist and read our data from disk and we'll cover sorting data.
  • Command line & project structure - Support multiple applications from one code base and read input from command line.
  • Time - using the time package to schedule activities.
  • WebSockets - learn how to write and test a server that uses WebSockets.

Questions and answers

I often run in to questions on the internets like

How do I test my amazing function that does x, y and z

If you have such a question raise it as an issue on github and I'll try and find time to write a short chapter to tackle the issue. I feel like content like this is valuable as it is tackling people's real questions around testing.

  • OS exec - An example of how we can reach out to the OS to execute commands to fetch data and keep our business logic testable/
  • Error types - Example of creating your own error types to improve your tests and make your code easier to work with.
  • Context-aware Reader - Learn how to TDD augmenting io.Reader with cancellation. Based on Context-aware io.Reader for Go
  • Revisiting HTTP Handlers - Testing HTTP handlers seems to be the bane of many a developer's existence. This chapter explores the issues around designing handlers correctly.

Meta / Discussion

  • Why - Watch a video, or read about why unit testing and TDD is important
  • Intro to generics - Learn how to write functions that take generic arguments and make your own generic data-structure
  • Anti-patterns - A short chapter on TDD and unit testing anti-patterns

Contributing

  • This project is work in progress If you would like to contribute, please do get in touch.
  • Read contributing.md for guidelines
  • Any ideas? Create an issue

Background

I have some experience introducing Go to development teams and have tried different approaches as to how to grow a team from some people curious about Go into highly effective writers of Go systems.

What didn't work

Read the book

An approach we tried was to take the blue book and every week discuss the next chapter along with the exercises.

I love this book but it requires a high level of commitment. The book is very detailed in explaining concepts, which is obviously great but it means that the progress is slow and steady - this is not for everyone.

I found that whilst a small number of people would read chapter X and do the exercises, many people didn't.

Solve some problems

Katas are fun but they are usually limited in their scope for learning a language; you're unlikely to use goroutines to solve a kata.

Another problem is when you have varying levels of enthusiasm. Some people just learn way more of the language than others and when demonstrating what they have done end up confusing people with features the others are not familiar with.

This ends up making the learning feel quite unstructured and ad hoc.

What did work

By far the most effective way was by slowly introducing the fundamentals of the language by reading through go by example, exploring them with examples and discussing them as a group. This was a more interactive approach than "read chapter x for homework".

Over time the team gained a solid foundation of the grammar of the language so we could then start to build systems.

This to me seems analogous to practicing scales when trying to learn guitar.

It doesn't matter how artistic you think you are, you are unlikely to write good music without understanding the fundamentals and practicing the mechanics.

What works for me

When I learn a new programming language I usually start by messing around in a REPL but eventually, I need more structure.

What I like to do is explore concepts and then solidify the ideas with tests. Tests verify the code I write is correct and documents the feature I have learned.

Taking my experience of learning with a group and my own personal way I am going to try and create something that hopefully proves useful to other teams. Learning the fundamentals by writing small tests so that you can then take your existing software design skills and ship some great systems.

Who this is for

  • People who are interested in picking up Go.
  • People who already know some Go, but want to explore testing with TDD.

What you'll need

  • A computer!
  • Installed Go
  • A text editor
  • Some experience with programming. Understanding of concepts like if, variables, functions etc.
  • Comfortable with using the terminal

Feedback

MIT license

Logo is by egonelbre What a star!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].