Tag

httptest

0 views collected around this technical thread.

Raymond Ops
Raymond Ops
Apr 17, 2025 · Backend Development

Master HTTP Mocking in Go: httptest & gock Tutorial

This article explains how to use Go's httptest package and the gock library to mock HTTP servers and external API calls, providing step‑by‑step code examples, test case design, and practical tips for reliable backend unit testing.

Gobackend developmentgock
0 likes · 13 min read
Master HTTP Mocking in Go: httptest & gock Tutorial
Go Programming World
Go Programming World
May 11, 2024 · Backend Development

Testing HTTP Applications in Go: Isolating External Dependencies

This article explains how to write reliable unit tests for Go HTTP applications by isolating external dependencies, covering server‑side handlers, client‑side monitoring, and using tools such as net/http/httptest, testify, and gock to create test doubles and mock HTTP services.

GoHTTPTestify
0 likes · 21 min read
Testing HTTP Applications in Go: Isolating External Dependencies
360 Tech Engineering
360 Tech Engineering
Feb 19, 2021 · Backend Development

Guide to Writing and Running Unit Tests in Go

This article explains the importance of unit testing for reliable software, introduces Go's built‑in testing framework, demonstrates how to write test files, use TestMain, benchmark code, and employ the httptest package for HTTP server testing, all illustrated with complete code examples.

Code CoverageGoTesting
0 likes · 12 min read
Guide to Writing and Running Unit Tests in Go
360 Smart Cloud
360 Smart Cloud
Feb 9, 2021 · Fundamentals

Why Write Tests and How to Write Unit Tests in Go

This article explains the long‑term benefits of unit testing such as saving time and money, reducing code complexity, providing documentation, and enabling performance evaluation, and then provides a detailed guide on writing, organizing, and running Go tests with code examples.

GoTestingbenchmark
0 likes · 12 min read
Why Write Tests and How to Write Unit Tests in Go