Molecule is an open source testing framework for Ansible roles, Playbooks and Collections. It creates temporary test instances, usually containers or virtual machines, applies your code, runs it again to confirm idempotence, runs verification tests and then destroys the instances. molecule test runs the full sequence.
Molecule tests whether a role actually works. It needs real or containerized hosts and runs slower than static checks, so teams usually run it on role changes, not on every commit to every Playbook.
Molecule vs policy checks: Molecule tests behavior on test hosts. Policy and governance checks, such as Steampunk Spotter, verify code against rules and target versions without running it. They catch different problems, and mature teams use both.