testing

Resolve Rails test failures with unit, integration, and system test commands.

36|6|Updated Apr 6, 2022
One-click install
npx skills add https://github.com/rubys/showcase --skill testing-rubys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/rubys/showcase/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/rubys/showcase --skill testing-rubys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive guidance on running tests, understanding coverage, and troubleshooting common issues in the Rails application. It helps you quickly diagnose and resolve test failures, particularly intermittent system test issues, ensuring your application remains robust.

Core Features & Use Cases

  • Comprehensive Test Execution: Get commands for running unit, integration, and system tests, including generating coverage reports.
  • Coverage Overview: Understand the current test coverage for critical application components like HeatScheduler, Entry model, and Table model.
  • Known Issue Troubleshooting: Access solutions for intermittent system test failures (race conditions) and asset routing errors, saving you debugging time.
  • Use Case: When a CI pipeline fails due to system test errors, use this skill to understand the common causes, get commands to rerun specific tests, and resolve asset-related issues, quickly getting your build back to green.

Quick Start

Use the testing skill to run all system tests for the Rails application and provide instructions if they fail due to asset routing errors.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Rails tests and generate coverage reports?

Run Rails tests using `rails test` for unit and integration tests, or `rails test:system` for system tests with Capybara. Generate coverage reports by running tests with coverage tooling to identify which application components like HeatScheduler, Entry model, and Table model are tested.

What causes intermittent system test failures in Rails?

Intermittent system test failures often stem from race conditions in Capybara and Selenium interactions. Common culprits include asset routing errors and timing issues. Rerun failed tests and check asset configuration in your test environment to resolve these issues.

Can I use Capybara and Selenium for Rails system testing?

Yes, Capybara and Selenium are standard tools for Rails system tests. They enable browser-based testing of user interactions, fixtures, and assets. This Skill covers troubleshooting common Capybara and Selenium issues in Rails applications.

How do I troubleshoot asset routing errors in Rails tests?

Asset routing errors occur when system tests cannot locate CSS, JavaScript, or image files. Configure your test environment to properly serve assets, and refer to Rails test asset guidance. This Skill provides specific troubleshooting steps for resolving these errors.

What's the difference between unit, integration, and system tests in Rails?

Unit tests verify individual model and component logic; integration tests check interactions between components; system tests use Capybara to simulate real user browser interactions. Rails provides `rails test` for units and integrations, `rails test:system` for system tests with fixtures.