Introduction to Testing in Go (Golang) (Udemy.com)
Learn how to write effective unit and integration tests in Go, for web applications and REST APIs
Created by: Trevor Sawler
Last updated June 2024
What you will learn
- Learn how to write unit tests in Go
- Learn how to write integration tests in Go, and simplify them using Docker
- Learn how to create test suites in Go
- Learn how to create a simple web application and test handlers, middleware, database, and more
- Learn how to create a simple REST API in Go and test its endpoints
- Learn to to authenticate using JWT Tokens (and refresh tokens) and completely test all functionality
- Learn how to write tests that cover multiple scenarios with table tests
Quality Score
No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.
Overall Score : 94 / 100
Course Description
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.
Instructor Details
- 4.7 Rating
847 Reviews
Trevor Sawler
I have twenty years of experience in professional software development, and twenty years of experience as a University professor.
As an entrepreneur, I have worked with a broad range of clients, including Thomson Nelson, Hewlett Packard, the Royal Bank of Canada, Keybank, Sprint, and many, many others. I also have extensive management and project management experience. I have led teams of fifty developers and artists on multi-million dollar projects, and much smaller teams on much smaller projects.
As a professor, I have taught in a wide variety of course areas, including Computer Science, English, Irish, and American literature, and a number of "crossover" courses that bridge the liberal arts and technological fields.
I have won regional, national, and international awards for my work in the IT field, and have also won awards for my teaching and research as a University professor.
More courses by Trevor Sawler
Building Modern Web Applications with Go (Golang) (2022)
4.6 (5,848 Reviews)
Provider: Udemy
Time: 29.6h
$84.99
Working with Microservices in Go (Golang) (2024)
4.6 (3,184 Reviews)
Provider: Udemy
Time: 11.6h
$89.99
Working with Concurrency in Go (Golang) (2024)
4.7 (1,862 Reviews)
Provider: Udemy
Time: 9.7h
$79.99
Building Web Applications with Go - Intermediate Level (2025)
4.8 (597 Reviews)
Provider: Udemy
Time: 18.7h
$84.99
More Software Testing courses
ZeroToHero TestNG Framework - From Basics to Advanced (2026)
4.9 (828 Reviews)
Provider: Udemy
Time: 6.2h
$59.99
Selenium WebDriver with Java- Basics to Advanced + Framework (2026)
4.9 (620 Reviews)
Provider: Udemy
Time: 35.5h
$84.99
Rest API Testing (Automation) from Scratch-Rest Assured Java (2026)
4.7 (49,120 Reviews)
Provider: Udemy
Time: 24.6h
$159.99
Quick Introduction to Postman and API Testing for Beginners (2025)
4.7 (23,089 Reviews)
Provider: Udemy
Time: 3.2h
$94.99
Software Testing Masterclass (2026) - From Novice to Expert
4.7 (12,621 Reviews)
Provider: Udemy
Time: 9.9h
$149.99
Testing Java: JUnit 5, Mockito, Testcontainers, REST Assured (2026)
4.7 (2,514 Reviews)
Provider: Udemy
Time: 10.7h
$84.99
Reviews
By Rahul Rao on 5/31/2026
Great instruction with a broad and fairly deep coverage of testing API's & web apps in Go. The course moves pretty fast and it may be difficult to keep up with the instructors pace of explanation especially if you're not well-versed in writing API's and web-apps in Go because the lectures cover just about what's enough to know in the context of testing and do not provide much explanation as to why a certain standard library feature is being used as its a testing focused course. The instruction is fairly verbose as each line including every comma, bracket newline etc. is being vocalized which adds to the length of each lecture. While this might benefit some learners it may be good to reduce talking about every little detail of typing the code and instead spend more time on the core principles and ideas of why things are being tested in a certain way. Overall a good course with a broad coverage of everything needed to get started writing unit & integration tests in Go!
By Renato Fagalde on 9/5/2025
I’m currently taking this course and I can say it’s really worth it. The instructor has solid knowledge of Go and testing practices, explaining the concepts clearly and objectively. The content is well-structured, with practical examples that make the learning process much easier. I highly recommend it to anyone who wants to dive deeper into testing with Go. Also, taking the course in English is a great opportunity to practice technical language and follow international best practices.
By Anonymized User on 6/17/2025
Trevor is an awesome instructor. This is the second course I have taken and I have 2 more lined up from him to grow my skill set in GoLang. He explains what needs explaining in a clear way. He also provides instructions in the examples he is using for everything, i.e. walks through setting up a SPA in the unit testing course, so I learn twice as much.
By Ewald Horn on 12/27/2024
This is an absolute must for anyone interested in doing proper testing in Go. The pace is just right, the coverage excellent and you build up valuable skills. My testing and general Go development skills improved by a fair margin. I feel that I received really good value with this course and highly recommend it.
By Andrey Vikhlyantsev on 8/27/2024
CONS - I wish there are practice tasks or at least some quizzes. All you do is follow and retype the lecture code in your IDE and run it - I wish there is some summary at the end PROS - Lecturer's explanations are clear, concise and in-deep. He explains every little part of the code he writes and the commands he performs - No parts where I found myself lost. If you make mistake and can't find it, you can always go to the source code and copy it
By Caio Feijão on 8/16/2024
I think it should focus more on testing and less on building the code the api and other services, i know its related to understand the context but could be less, example section 13 basically is just building the SPA with only the two last lessons being about tests wich is the main focus of the course
By Junior Paula on 7/8/2023
Sem sombra de duvidas esse é o melhor curso de golang. O tema sobre testes é muito bem abordado, o instrutor tem pleno dominio sobre o assunto. Eu ja fiz outro curso desse mesmo professor e todos estão de parabéns, sigo fazendo o resto que me falta sobre golang, e recomendo muito pra quem esta querendo aprender umm pouco mais sobre a linguagem e claro não tem problemas em entender o ingles falado. OBS: Escrevi em Portugues para que outros Brasileiros como eu que se enteressam por conteudo de qualidade possam ver que não so esse, como outros curso do professor são de boa qualidade.
By John Dobson on 2/7/2023
An excellent educational experience after programming for > 30 years, I finally got to perform unit tests thoroughly; it almost made me want to try TDD. I want to structure the application files differently so that the test files are separated from the project files into a test directory to reduce apparent complexity.
By Trent Clowater on 1/24/2023
Excellent course. Unlike a lot of testing courses are very superficial, with only trivial examples, this course goes into testing of databases, traditional web applications, and APIs. The examples are simple but realistic applications that cover common patterns. Would highly recommend. Would also love it if Mr. Sawler would create a testing course that went into how to test applications that use a lot of concurrency. He is great at explaining things clearly, but concisely.
By Gabriel Pozo on 11/13/2022
It's a complete course, like all courses from Trevor Sawler. The only thing maybe will be exciting to add to this course is how to write TDD and his workflow.












