Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Testunit Skill

ASecurity

Generates Test::Unit tests in Ruby. Classic xUnit-style testing with assert methods and test case classes. Use when user mentions "Test::Unit", "assert_equal Ruby", "Ruby test-unit". Triggers on: "Test::Unit", "Ruby test-unit", "assert_equal Ruby" (not RSpec).

36 stars
0 votes
0 copies
0 views
Added 9/22/2026
code-qualitygorubytestingdebuggingdatabaseci/cd

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add NVlabs/Skill2Env --skill testunit-skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testunit Skill?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Testunit Skill
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nvlabs-testunit-skill/badge)](https://www.skillsdirectory.com/skills/nvlabs-testunit-skill)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: testunit-skill
description: >
  Generates Test::Unit tests in Ruby. Classic xUnit-style testing with assert
  methods and test case classes. Use when user mentions "Test::Unit",
  "assert_equal Ruby", "Ruby test-unit". Triggers on: "Test::Unit",
  "Ruby test-unit", "assert_equal Ruby" (not RSpec).
languages:
  - Ruby
category: unit-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# Test::Unit Ruby Skill

## Core Patterns

### Basic Test

```ruby
require 'test/unit'

class TestCalculator < Test::Unit::TestCase
  def setup
    @calc = Calculator.new
  end

  def test_addition
    assert_equal(5, @calc.add(2, 3), "2 + 3 should equal 5")
  end

  def test_subtraction
    assert_equal(1, @calc.subtract(3, 2))
  end

  def test_division_by_zero
    assert_raise(ZeroDivisionError) { @calc.divide(10, 0) }
  end

  def test_float_division
    assert_in_delta(3.33, @calc.divide(10, 3), 0.01)
  end

  def teardown
    # cleanup
  end
end
```

### Assertions

```ruby
assert_equal(expected, actual, message = nil)
assert_not_equal(unexpected, actual)
assert_true(value)
assert_false(value)
assert_nil(value)
assert_not_nil(value)
assert_instance_of(klass, obj)
assert_kind_of(klass, obj)
assert_respond_to(obj, :method_name)
assert_match(/pattern/, string)
assert_no_match(/pattern/, string)
assert_include(collection, item)
assert_not_include(collection, item)
assert_empty(collection)
assert_not_empty(collection)
assert_raise(ErrorClass) { block }
assert_nothing_raised { block }
assert_in_delta(expected, actual, delta)
assert_operator(value, :>, 5)
assert_send([obj, :method, arg])
assert_block("message") { condition }
```

### Test Fixtures

```ruby
class TestDatabase < Test::Unit::TestCase
  def self.startup
    # Once before all tests in class
    @@db = Database.connect('test')
  end

  def self.shutdown
    # Once after all tests in class
    @@db.disconnect
  end

  def setup
    # Before each test
    @@db.begin_transaction
  end

  def teardown
    # After each test
    @@db.rollback
  end
end
```

### Test Ordering and Naming

```ruby
class TestUserService < Test::Unit::TestCase
  # Methods must start with 'test_'
  def test_create_user
    user = UserService.create('Alice', 'alice@test.com')
    assert_not_nil(user)
    assert_equal('Alice', user.name)
  end

  def test_find_user_by_email
    user = UserService.find_by_email('alice@test.com')
    assert_instance_of(User, user)
  end
end
```

## Setup: `gem install test-unit`
## Run: `ruby test/test_calculator.rb` or `ruby -Itest -e "Dir.glob('test/**/test_*.rb').each{|f| require f}"`
## Autodiscovery: `testrb test/` (with test-unit gem)

## Deep Patterns

For advanced patterns, debugging guides, CI/CD integration, and best practices,
see `reference/playbook.md`.

Attribution

NVlabsNVlabs
View sourceMore from NVlabs →
SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Know which skills are safe — weekly.

Best new skills + every skill we flagged as malicious. From the team that scanned 103,619.

Join free

Related Skills

Caveman Review

Ultra-compressed code review comments. Cuts noise from PR feedback while preserving the actionable signal. Each comment is one line: location, problem, fix. Use when user says "review this PR", "code review", "review the diff", "/review", or invokes /caveman-review. Auto-triggers when reviewing pull requests.

1066601 votes

Caveman Commit

Ultra-compressed commit message generator. Cuts noise from commit messages while preserving intent and reasoning. Conventional Commits format. Subject ≤50 chars, body only when "why" isn't obvious. Use when user says "write a commit", "commit message", "generate commit", "/commit", or invokes /caveman-commit. Auto-triggers when staging changes.

1066601 votes

Springboot Verification

Verification loop for Spring Boot projects: build, static analysis, tests with coverage, security scans, and diff review before release or PR.

2456590 votes

Verification Loop

一个全面的 Claude Code 会话验证系统。

2456590 votes

Django Verification

Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.

2456590 votes
View all in code-quality →