create-test-scenarios

Create Automatus test scenarios for ComplianceAsCode security rules.

2.8k|823|Updated Apr 29, 2014
One-click install
npx skills add https://github.com/ComplianceAsCode/content --skill create-test-scenarios
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-test-scenarios
Source: https://github.com/ComplianceAsCode/content/tree/main/.claude/skills/create-test-scenarios
Command: npx skills add https://github.com/ComplianceAsCode/content --skill create-test-scenarios

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing test scenarios for ComplianceAsCode security rules requires deep knowledge of the Automatus framework, Jinja2 templating, OVAL checks, and remediation behavior. This Skill guides the creation of correct pass/fail test scenarios for Linux rules, reducing trial-and-error and broken tests.

Core Features & Use Cases

  • Rule Analysis: Reads rule.yml and rendered OVAL/remediation content via MCP tools to determine exactly what to test.
  • Scenario Design: Proposes pass and fail scenario pairs covering edge cases like missing config, wrong values, and .d directories.
  • Test Authoring: Writes Bash test files using project Jinja2 syntax, shared helpers from tests/shared/, and templated scenarios for reusable rules.
  • Verification: Runs scenarios through Automatus with oscap and ansible remediations and interprets results.
  • Use Case: Given a rule ID like sshd_disable_root_login, generate a complete set of pass and fail test scenarios, place them in the correct directory, and verify they pass in Automatus.

Quick Start

Create Automatus test scenarios for the rule sshd_disable_root_login and verify them with the test-rule skill.

Frequently Asked Questions about create-test-scenarios

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

FAQPage Schema
How do I create Automatus test scenarios for a ComplianceAsCode rule?

Read the rule's rule.yml and rendered OVAL/remediation content, then design pass scenarios for compliant states and fail scenarios for non-compliant but remediable states. Write Bash files ending in .pass.sh or .fail.sh in the rule's tests/ directory and verify them with Automatus.

What is the difference between pass and fail test scenarios in Automatus?

Pass scenarios configure a compliant system and expect the scan to pass. Fail scenarios configure a non-compliant system, expect the initial scan to fail, then Automatus remediates and expects the rescan to pass.

Does this skill support OpenShift or ocp4 rule tests?

No, the skill covers Linux rules only. OpenShift tests, such as those in ocp4 directories, are explicitly out of scope.

Where do I put test scenarios for templated rules?

Reusable scenarios go in shared/templates/<template_name>/tests/ using CAPITAL-letter template parameters. Rule-specific scenarios go in the rule's own tests/ subdirectory, and test_config.yml can allow or deny templated scenarios per rule.

Why does my fail test scenario fail after remediation?

The remediation likely cannot fix the state your scenario creates, for example a wrong value when the remediation only appends missing lines. Verify the remediation logic against the rendered content before designing the fail state.

What Jinja syntax do ComplianceAsCode test scenarios use?

The project uses non-standard delimiters: triple braces {{{ }}} for expressions and {{% %}} for control flow. Using default Jinja syntax like {{ }} is a common mistake that breaks rendering.