write-content-tests

Generates functional Molecule test scenarios for Ansible roles and playbooks.

8|7|Updated Feb 14, 2023
One-click install
npx skills add https://github.com/eclipse-slm/slm --skill write-content-tests-eclipse-slm
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-content-tests
Source: https://github.com/eclipse-slm/slm/tree/main/.agents/skills/write-content-tests
Command: npx skills add https://github.com/eclipse-slm/slm --skill write-content-tests-eclipse-slm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing tests for Ansible roles and playbooks often results in structural tests that merely re-verify built-in modules (file exists, content matches) instead of proving the automation achieved its intended outcome. This Skill generates functional Molecule scenarios and audits existing tests to replace structural checks with outcome-based verification. ## Core Features & Use Cases - Write Mode: Generates complete Molecule scenarios (molecule.yml, converge.yml, verify.yml) with functional assertions such as service port checks, sudo permission validation, and DNS resolution tests. - Improve Mode: Audits existing Molecule scenarios against an eight-category checklist, scores quality on a 1-10 scale, and recommends the top three structural-to-functional test conversions. - Use Case: Given a role that installs nginx and configures a firewall, the Skill produces a verify.yml that asserts the service responds on its port and the HTTPS endpoint is reachable, rather than checking that config files exist. ## Quick Start Ask the assistant to write Molecule functional tests for your Ansible role at a given path, or to review and improve an existing molecule scenario directory.

Frequently Asked Questions about write-content-tests

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

FAQPage Schema
How do I write Molecule tests for an Ansible role?▼

Create a molecule/default directory with molecule.yml, converge.yml, and verify.yml files. Converge applies the role, and verify uses functional assertions like checking that a service responds on its port rather than checking that files exist.

What is the difference between functional and structural Ansible tests?▼

Functional tests verify the intended outcome, such as a service responding on a port or a user having correct sudo permissions. Structural tests check file existence or content, which only retests built-in Ansible modules already covered upstream.

Does Molecule support testing Ansible collections?▼

Yes, collection roles use scenarios under extensions/molecule/ with a shared config.yml and inventory.yml. The default scenario manages create and destroy lifecycle while component scenarios inherit the shared configuration.

Why does Molecule idempotence testing fail?▼

Idempotence fails when converge tasks report changes on the second run, commonly from command or shell tasks missing changed_when: false, templates with dynamic timestamps, or unnecessary service restart handlers. These indicate bugs in the role itself.

When are structural tests appropriate in Molecule verify playbooks?▼

Structural tests are appropriate for custom modules without upstream tests, complex Jinja2 templates requiring exact output schemas, generated configs with computed values, and idempotency regression checks. Functional tests remain preferred whenever feasible.