Writing good tests for your existing deployments or distributed software
infrastructure should be painless, and easily accomplishable without
involving any time-consuming and complex testing setup.
This is where goodplay comes into play.

goodplay instruments Ansible — “a radically simple IT automation platform”
as it is advertized — and allows you to write your tests in the same simple
and probably already familiar language you would write an Ansible playbook.

Ansible itself comes bundled with some testing facilities mentioned in the
Ansible Testing Strategies documentation.
It makes a low-level assert module available which helps to verify that
some condition holds true, e.g. some output from a previous task which has
been stored in a variable contains an expected value.

Although it can be sometimes necessary to use something low-level as Ansible’s
assert, goodplay enables you to use high-level modules for describing
your test cases.

Besides the actual testing, goodplay takes care of setting up and tearing down
the test environment as well as collecting the test results – both being
something Ansible was not made for.

pytest-ansible is as the name already implies a pytest plugin just like
goodplay.
But instead of being used for testing Ansible playbooks or roles, it provides
pytest fixtures that allow you to execute Ansible modules from your
Python-based tests.

serverspec seems to be more targeted to assert hosts are in a defined
state.
In comparison to goodplay it allows you to run tests against single hosts
only and does not include test environment management.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.