
Install go by visiting go.dev, choosing the correct OS package, and following the platform-specific installation steps. Verify the setup by running go version in the terminal.
Install and configure an integrated development environment to simplify Go development. Download Visual Studio Code, install the official Go extension, and enable Go template syntax highlighting.
Create a command line Go application that determines if a number is prime. Implement an isPrime function with a for loop and modulus checks, handle edge cases, and print results.
Learn to test the Go check numbers function by simulating input with a prefilled reader and a table-driven approach, covering empty input, primes, non-primes, negative numbers, and quit.
Implement simple validation logic in a Go web app and test it, highlighting that validation is critical for any application. We'll cover a few validators and verify them through tests.
Finish testing the validation logic in Go by validating the check and get functions, using a form with a password field, and achieving full test coverage.
Demonstrates connecting the web app to the database by using a db wrapper, querying users by email, and validating the setup via Docker and login.
Add an authenticate function in the login handler to verify password hash against the data user password, store the user in the session, and redirect on error with gob registration.
Update the application to use the database repository by replacing the direct postgres connection with a repository db repo, and wire the login handler to use it.
Connect to Docker and start a Postgres image with user, password, and database; wait for readiness, create empty users and users_image tables, run tests, and purge to reset state.
Writing unit tests and integration tests is one of the most-neglected aspects of software development. All too often, a developer will find him or herself say "but it works on my computer!" when a project is presumed finished, only to discover that once taken out of the development environment, things don't work as expected.
Well written unit tests and integration tests help to solve this problem, and in fact almost without exception will reduce overall development time, rather than adding to it. In addition, well-tested code almost always requires less maintenance, and the end product will have less down time.
This course is focused on writing unit and integration tests in Go, a modern, type safe, compiled, and extremely fast programming language. It it is ideally suited for building safe, scalable, incredibly fast web applications, and it has powerful testing tools built right in.
In this course, we will build four simple applications, and thoroughly test them:
A command line application (CLI) that tries to determine if a user-entered number is prime or not;
A simple web application that allows a user to log in and upload a profile picture;
A simple REST API built on the same code base as the web application which allows users to authenticate using JWT tokens and perform operations against a Postgres database. We'll go through the entire authentication process, including using refresh tokens, and thoroughly test all aspects of the code.
A simple Single Page Web Application (SPA), written in Vanilla JavaScript, that demonstrates how to use JWT and Refresh Tokens with a SPA, and how to test that functionality.
For each of these projects, we will learn how to write unit tests for all functionality. We will learn how to test (among other things):
Application routes
Application handlers
How to test multiple scenarios by writing and using table tests
Database operations (using the Repository pattern)
Application middleware
User authentication (with sessions)
User authentication (with JWT tokens)
JWT token generation and validation
Refresh token generation and validation
Testing user input
Writing to the terminal
Adding cookies to a request
Reading cookies from a response
By the end of this course, you will have a solid understanding of how to write effective tests, and how to write testable code.
Please note that this course requires you to download Docker Desktop from Docker. If you are a Udemy Business user, please check with your employer before downloading software.