Skip to content
Back to skills

Cairo Testing

ASecurity

Explain how to write and run Cairo tests, including `#[test]`, assert macros, `#[should_panic]`, `#[ignore]`, and `#[available_gas]`; use when a request involves writing or running unit tests in Cairo.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
testingtesting

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill cairo-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cairo Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cairo Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-cairo-testing/badge)](https://www.skillsdirectory.com/skills/david-li0406-cairo-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cairo-testing
description: Explain how to write and run Cairo tests, including `#[test]`, assert macros, `#[should_panic]`, `#[ignore]`, and `#[available_gas]`; use when a request involves writing or running unit tests in Cairo.
---

# Cairo Testing

## Overview
Guide writing test functions, using assertion macros, and running tests with Scarb.

## Quick Use
- Read `references/testing.md` before answering.
- Put tests in a `#[cfg(test)]` module in `src` files.
- Use the right assert macro for the expected condition.

## Response Checklist
- Add `#[test]` above each test function.
- Use `assert!`, `assert_eq!`, `assert_ne!`, or comparison macros as needed.
- Assert message arguments must be string literals, not variables (e.g., `assert!(x, "msg")` not `assert!(x, msg)`).
- Use `#[should_panic(expected: "...")]` for panic-based tests.
- Use `#[ignore]` for slow tests and `scarb test --include-ignored` when needed.
- Add `#[available_gas(n)]` for recursion or long loops.

## Example Requests
- "How do I write a basic test in Cairo?"
- "How do I assert a panic message?"
- "How do I run a single test?"

## Cairo by Example
- [Testing](https://cairo-by-example.xyz/testing)
- [Unit testing](https://cairo-by-example.xyz/testing/unit_testing)
- [Integration testing](https://cairo-by-example.xyz/testing/integration_testing)
- [Dev-dependencies](https://cairo-by-example.xyz/testing/dev_dependencies)
- [Scarb Tests](https://cairo-by-example.xyz/scarb/test)
- [Attributes: cfg](https://cairo-by-example.xyz/attribute/cfg)

Files in this skill

  • SKILL.md1.5 KB
  • references/testing.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…