qmetrics.net

sqlmock

Go sql/driver mock for database unit tests

sqlmock simulates SQL driver behavior in Go tests so code can be checked without a live database connection.

Overview

go-sqlmock implements the sql/driver interface so unit tests can open a mock database connection and assert expected queries, arguments, transactions, and results. It exists solely to mimic driver behavior in tests while keeping a test-driven workflow intact.

Expectations can cover prepares, executes, queries, transactions, and result rows, with strict ordering by default. The library supports concurrency, multiple connections, context-related features, and named parameters without changing application source code.

Custom QueryMatcher implementations allow regexp, equality, or bespoke SQL matching when drivers use nonstandard syntax. An Argument interface enables richer matching for values such as timestamps.

The project describes itself as stable with few new changes. Users who need real transactional integration tests are pointed toward separate functional test databases.

Key features

  • Mock sql/driver implementation
  • Expected query and exec matching
  • Custom SQL query matchers
  • Rows and result simulation
  • Context and named parameters
  • Concurrent connection support
  • Strict expectation ordering

Use cases

  • Go database layer unit tests
  • TDD without live DB
  • Testing error and edge SQL paths
  • CI pipelines without database service

Tags

Similar software

Selenium

Cross-language browser automation via W3C WebDriver

Selenium automates Chrome, Firefox, Edge, and Safari from Java, Python, C#, Ruby, JavaScript, or Kotlin. It implements the W3C WebDriver standard and downloads browser drivers automatically.

★ 34.6k⟳ todayApache-2.0

Testify

Go test helpers for assertions, mocks, and suites

Testify is a set of Go packages that extend the standard testing library with readable assertions, hard failures, mocks, and structured suites. Install it with go get.

★ 26.3k⟳ 2 months agoMIT

React Testing Library

React DOM component testing utilities

A lightweight library that adds testing helpers on top of react-dom and react-dom/test-utils. It steers tests toward user-like DOM interaction instead of component implementation details.

★ 19.7k⟳ 3 months agoMIT

volkswagen

Node library that passes tests under CI detection

Volkswagen is a small Node module that detects continuous-integration environments and alters test behavior so suites exit successfully when run on CI servers.

★ 15.5k⟳ 9 months agoMIT

Mockito

Java mocking framework for unit tests

Mockito is a mocking framework for unit tests written in Java. It provides a small API to create mocks, stub behavior, verify interactions, and support partial spies and injection.

★ 15.5k⟳ 2 days agoMIT

supertest

Node.js HTTP server testing via superagent

Supertest offers a fluent API for asserting HTTP behavior against Node.js servers during automated tests. It builds on superagent so you can express status, headers, and body expectations in code.

★ 14.4k⟳ 21 days agoMIT