CtrlK
BlogDocsLog inGet started
Tessl Logo

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Apply when the codebase imports github.com/stretchr/testify.

88

1.37x
Quality

89%

Does it follow best practices?

Impact

84%

1.37x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Evaluation results

98%

Test Suite for a Cache-Backed User Repository

Testify suite lifecycle and require syntax

Criteria
Without context
With context

Suite embeds suite.Suite

100%

100%

Launcher function present

100%

100%

SetupSuite for one-time init

100%

100%

SetupTest for per-test mocks

100%

100%

s.Require() for preconditions

100%

100%

Suite method naming

100%

100%

All three test cases present

100%

100%

is/must naming convention

100%

100%

AssertExpectations called

80%

80%

No assert for guards

100%

100%

suite.Run receives new(Suite)

100%

100%

Package compiles

100%

100%

100%

78%

Testing a Payment Processor with Retry Logic

Mock patterns: MatchedBy, retry .Once() chaining, AssertExpectations

Criteria
Without context
With context

Mock embeds mock.Mock

0%

100%

m.Called() in methods

0%

100%

AssertExpectations called

0%

100%

mock.MatchedBy for AuditEntry

0%

100%

Predicate checks Amount

37%

100%

Predicate checks Status

37%

100%

Chained .Once() for retry

0%

100%

Retry call count verified

80%

100%

mock.Anything for context

0%

100%

No exact AuditEntry equality

100%

100%

.Once() or .Times() used

0%

100%

54%

-10%

Tests for a Report Generation Service

Advanced assertions: JSONEq, ElementsMatch, InDelta, ErrorIs, EventuallyWithT

Criteria
Without context
With context

JSONEq for JSON comparison

100%

100%

No string equal for JSON

100%

100%

ElementsMatch for unordered slice

0%

0%

InDelta for float tolerance

100%

100%

ErrorIs for wrapped error

100%

100%

No Equal for error check

100%

100%

Pointer not compared with Equal

50%

0%

EventuallyWithT for async

0%

0%

Multiple assertions in callback

0%

0%

No Eventually without T

100%

0%

require for preconditions

100%

100%

is/must naming

100%

100%

Repository
samber/cc-skills-golang
Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.