Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mockio

> 测试质量
Open source

Mockito for golang

195 stars0 likes2 views
WebsiteGitHub

About

Mockito for golang

Mockio

Mock library for golang without code generation

Mockio is a Golang library that provides functionality for mocking and stubbing functions and methods in tests inspired by mockito. The library is designed to simplify the testing process by allowing developers to easily create test doubles for their code, which can then be used to simulate different scenarios.

Documentation

Latest documentation is available here

Quick start

Install latest version of the library using go get command:

bash
go get -u github.com/ovechkin-dm/mockio/v2

Create a simple mock and test:

go
package main

import (
    . "github.com/ovechkin-dm/mockio/v2/mock"
    "testing"
)

type Greeter interface {
    Greet(name string) string
}

func TestGreet(t *testing.T) {
    ctrl := NewMockController(t)
    m := Mock[Greeter](ctrl)
    WhenSingle(m.Greet("John")).ThenReturn("Hello, John!")
    if m.Greet("John") != "Hello, John!" {
        t.Fail()
    }
}

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogogolangmockmocking

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.