Skip to content

Latest commit

 

History

History

GolangTesting

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Golang Testing

Credits

  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
  19. Templating - Use Go's html/template package to render html from data, and also learn about approval testing
  20. Generics - Learn how to write functions that take generic arguments and make your own generic data-structure
  21. Revisiting arrays and slices with generics - Generics are very useful when working with collections. Learn how to write your own Reduce function and tidy up some common patterns.

Build an application with TDD

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.