golang-stretchr-testify
Write Better Go Tests with Testify
Testify gives Go developers readable assertions, reliable mocks, and structured suites. This skill helps AI generate and review focused tests with correct failure behavior and expectation checks.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "golang-stretchr-testify" from https://skillstore.io/skills/samber-golang-stretchr-testify.md and its manifest at https://skillstore.io/api/skills/samber-golang-stretchr-testify/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "golang-stretchr-testify". How should a test handle a wrapped ErrNotFound value?
Expected outcome:
Use testify ErrorIs to match the wrapped error chain. Reserve equality assertions for values that require exact comparison.
Using "golang-stretchr-testify". Why did my mock-based test pass when the dependency was never called?
Expected outcome:
- Define the expected method call with an explicit call count.
- Run AssertExpectations at the end of the test.
- Use a specific matcher when the argument must be validated.
Using "golang-stretchr-testify". How should a suite initialize a fresh mock for every test?
Expected outcome:
Use SetupTest for per-test state, reserve SetupSuite for shared resources, and include the launcher that calls suite.Run.
Security Audit
SafeAll 38 static findings are false positives caused by prose, Markdown delimiters, Go raw string literals, evaluation text, or benign metadata. The reviewed files contain no evidence of executable shell commands, dynamic loading, system reconnaissance, network activity, or prompt injection.
Risk Factors
โก Contains scripts (2)
โ๏ธ External commands (33)
๐ Network access (1)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/samber-golang-stretchr-testify/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/samber-golang-stretchr-testify?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/samber-golang-stretchr-testify?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-stretchr-testify/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/samber-golang-stretchr-testify.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
samber. (2026). golang-stretchr-testify security audit report (audit version 1) [Author version 1.3.1]. Skillstore. https://skillstore.io/skills/samber-golang-stretchr-testify/audits/1BibTeX citation
@techreport{samber-samber-golang-stretchr-testify-2026,
author = {samber},
title = {golang-stretchr-testify security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-stretchr-testify/audits/1},
note = {Author version 1.3.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-stretchr-testify security audit report (audit version 1)"
version: "1.3.1"
type: report
authors:
- name: "samber"
date-released: "2026-09-23"
url: "https://skillstore.io/skills/samber-golang-stretchr-testify/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-stretchr-testify:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore Score
Why this score Evidence Confidence: MediumWhat You Can Build
Add focused unit tests
Generate readable Go tests with fail-fast preconditions and clear value assertions for new functions.
Build dependable mocks
Define mock expectations, argument matchers, call counts, and retry responses for isolated service tests.
Review existing test suites
Find assertion-order errors, missing expectation verification, incorrect suite lifecycle usage, and pointer comparison mistakes.
Try These Prompts
Write a testify test for a function that parses a configuration. Use require for parsing and nil preconditions, then use assert for expected field values.
Create a testify mock for a Sender interface. Verify one call with a specific email, use a context matcher, and check all expectations.
Convert these related Go tests into a testify suite. Use shared database setup, fresh mock state before each test, cleanup hooks, and a working suite launcher.
Design a testify test for an asynchronous client that retries after a timeout. Use sequential mock returns, EventuallyWithT, collected assertions, and explicit timeout intervals.
Best Practices
- Use require for setup failures that make later assertions unsafe, and use assert for independent outcomes.
- Make mock expectations explicit with suitable matchers, call counts, and final verification.
- Keep suite lifecycle responsibilities clear and run testifylint during review or continuous integration.
Avoid
- Using assert for a nil-sensitive precondition and then dereferencing the failed value.
- Comparing wrapped errors with direct equality instead of checking the error chain.
- Defining mock expectations without verifying them or creating a suite without its launcher.
Frequently Asked Questions
When should I use require instead of assert?
How do I check a wrapped Go error?
How do I verify a mock call count?
What matcher ignores an argument value?
How do testify suites run?
Can this skill replace testify documentation?
Developer Details
Author
samberLicense
MIT
Author version
v1.3.1
Skillstore revision
r1
Ref
2aa351cb09c29b7287d263bd8ea81e9bee3b2a61
Maintenance freshness
9/30/2026
Usage
0 downloads ยท 0 views
File structure