# Tests folder in skeleton created by ansible-galaxy

**URL:** <https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226>\
**Category:** Get Help\
**Tags:** galaxy-ng\
**Created:** [August 25, 2026, 2:01pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226 "2026-08-25T14:01:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgaiacs](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rgaiacs/32/11102_2.png) [@rgaiacs](https://forum.ansible.com/u/rgaiacs)\
**Post date:** [August 25, 2026, 2:01pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226/1 "2026-08-25T14:01:45Z")

</div>

Hi,

Thanks for this incredible project and community.

I run

```auto
ansible-galaxy role init mwe

```

and it created

```auto
mwe/
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── README.md
├── tasks
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
    └── main.yml

```

I’m trying to understand a little better how to use the `tests` folder or if I should use the Molecule framework.

Any recommendation? Thanks!

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [August 25, 2026, 2:25pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226/2 "2026-08-25T14:25:49Z")

</div>

In the `tests` folder I put complete test playbooks that can be executed on any host without any requirements besides the role intself, I execute them on localhost. This is just another source of quick tests for the role, I design these playbooks specifically for that purpose. I have also molecule and other tests.

As far as I know there is no community or ansible standard what to put there, moreover almost all the roles I’ve seen have no content in the `tests` folder.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [August 25, 2026, 3:18pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226/3 "2026-08-25T15:18:31Z")

</div>

@kks , how exactly do you invoke such test playbooks?

I’ve got a few roles with some ad hoc tests in `./tests/test.yml`, but I end up with a little forest of unreproducible symbolic links and inconsistent one-off notes about how to run the tests. I’ve never figured out how those playbooks under `./tests/` are supposed to be run.

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [August 25, 2026, 8:43pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226/4 "2026-08-25T20:43:17Z")

</div>

I package all ansible content inside collections and I have unconventional repo structure.  
I put collections inside repo like this

```bash
ansible_collections/<collection_namespace>/<collection_name>/roles/<role_name>

```

I think in several places already I’ve advocated for this kind of folders structure - from my point of view it simplifies a lot of things.

In the `tests` folder inside role I use FQCN for the role ..\<role\_name\>

I simply run all the yaml files with the name `test_*.yml` from `tests` folders. Find them with `find` command and run them with ansible-playbook from the root of the project with environment variable `ANSIBLE_COLLECTIONS_PATH=.:$ANSIBLE_COLLECTIONS_PATH`. Ansible find all the collections inside this repo first in that case. So I just have to update the role or test inplace without commit or installation and all tests (from `tests` folder) will run correctly.

Just for refenrence  
[https://docs.ansible.com/projects/ansible/latest/reference\_appendices/config.html#collections-paths](https://docs.ansible.com/projects/ansible/latest/reference_appendices/config.html#collections-paths)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 24, 2026, 8:43pm UTC](https://forum.ansible.com/t/tests-folder-in-skeleton-created-by-ansible-galaxy/46226/5 "2026-09-24T20:43:26Z")

</div>

Closed on September 24, 2026, 8:43pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
