This lesson is locked. Login or Subscribe for more access!

Advanced Debugger use on Table tests

Duration: 30 mins

Deeper dive into using the debugger in GoLand on Table-Driven Tests

Instructor

Matt Boyle

Share with a friend!

Transcript

This comprehensive video covers three main topics: implementing a search endpoint for the todo application, using the debugger in Goland, and writing unit tests. Here are the key points:

Search Implementation: - Created a search function that takes a query string and returns matching todos - Initial implementation had case sensitivity issues, discovered through testing - Used strings.Contains for basic matching functionality

Debugging in Goland: - Demonstrated how to set breakpoints by clicking in the gutter - Showed how to use the debugger to inspect variables and evaluate expressions - Used the debugger to identify and fix the case sensitivity issue in the search function

Unit Testing: - Introduced table-driven tests, a popular testing pattern in Go - Created test cases for different search scenarios (case sensitivity, spaces in queries) - Demonstrated how to use Goland's test coverage features - Showed how to run individual tests or the entire test suite - Achieved 75% test coverage for the todo package

The video concludes by suggesting exercises for viewers (adding more test cases, particularly for the add function) and previews the next video about implementing database storage with Docker instead of in-memory arrays.