# Should we be using molecule or ansible-test for unit/integration tests?

**URL:** <https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539>\
**Category:** Get Help\
**Tags:** ansible-test, molecule, galaxy-ng\
**Created:** [May 6, 2024, 10:11pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539 "2024-05-06T22:11:50Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryguy](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ryguy/32/3305_2.png) [@ryguy](https://forum.ansible.com/u/ryguy)\
**Post date:** [May 6, 2024, 10:11pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/1 "2024-05-06T22:11:50Z")

</div>

Hello all,

I had a general question about the use-cases/purpose of molecule vs ansible-test. For some background , I’m on a team that has a large repo with many custom roles and a number of custom plugins and modules. We have **not** moved our repo to the galaxy model yet, though we do make use of some third party collections and of course the community collection.

We do not use ansible-test at all at this time. We do, however, use tox + pytest for our plugin and module unit tests and molecule (3 currently) for role unit and integration tests.

My question is this: I’ve become the molecule SME over time and the rest of my team finds it extremely cumbersome to use. Given where ansible’s development energy and attention is being used, if we were to start from a blank slate, which testing tool should we choose or what reasons would we choose one over the other?

One thing that jumps out at me is that it seems as though ansible-test really expects you to be in a collection dir or have pulled down the ansible repo and sourced the env script under the hacking dir. Perhaps that is my answer right there; galaxy (ansible-test) vs no galaxy (molecule).

I will be spending time refactoring our repo and tests and wanted to make sure I was starting off on the right foot.

Thanks!

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [May 9, 2024, 8:36pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/2 "2024-05-09T20:36:53Z")

</div>

I never used molecule, so I can’t say much about it. But let me write some general notes first.

For unit tests and sanity tests for modules and plugins I’d always use ansible-test. Of course that requires you to have a collection (I guess that’s what you mean with galaxy model?). I think it’s a good idea to migrate to using collections, even if you ‘only’ use local collections (i.e. a `collections/ansible_collections/<namespace>/<name>/` directory structure below your playbook directory). This allows you to use all tooling that’s available for collections, like module/plugin sanity tests and docsite creation and docs validation with antsibull-docs.

I’m not sure how well molecule is working with collections though; I think there are collections that use molecule for role tests, and maybe also for module/plugin integration tests, so it can be done.

I’m personally using ansible-test also for role integration tests (for roles inside collections), though that doesn’t seem to be very common, but since I already use it for integration tests for modules and plugins, it’s easier to use it also for roles than using something else (with a different setup procedure) for roles.

The next part might be completely wrong since my knowledge of molecule is very limited and I don’t have hands-on experience.

I think molecule has a better test isolation than ansible-test, since you get a new environment for every role/module/plugin (or at least that’s how I understood it, maybe I’m also wrong 🙂 ). But that also implies that ansible-test will be faster if the setup takes enough time. But you have to watch out that you don’t end up in a situation where running all tests passes, but only running some specific tests doesn’t (because other tests install required dependencies which some other tests forget to install).

---

<div class="post-metadata">

**Author:** ![rodrigargar](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rodrigargar/32/3443_2.png) [@rodrigargar](https://forum.ansible.com/u/rodrigargar)\
**Post date:** [May 14, 2024, 11:29am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/3 "2024-05-14T11:29:09Z")

</div>

Hi @ryguy,

I am using molecule for testing my roles. I have not moved the roles to collections yet, but you can find how to deal with roles inside collections in the [molecule documentation](https://ansible.readthedocs.io/projects/molecule/getting-started/) , as it is the default now. I would say molecule is ideal to test your roles because you can create infra from scratch and test them locally, either with the help of containers or VMs. For my roles, I am using molecule’s docker driver to create the infra.

On the other hand, I have no experience with ansible-test. So I am a bit on the opposite side of @felixfontein. I guess that if you have your own modules and want to follow Ansible conventions, use ansible-test. To test your roles on fresh infra, use molecule.

Cheers,  
Rodrigo

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [June 12, 2024, 8:01pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/4 "2024-06-12T20:01:37Z")

</div>

A thing I wanted to add here some time ago, but apparently forgot to send off:

To be honest, after reading [ERROR: invalid-extension: Official Ansible modules must have - #4 by sivel](http://forum.ansible.com/t/5719/4), I wouldn’t recommend ansible-test for integration tests anymore.

(I’m not not recommending it, either, though. Also, a related thread: [Ansible Collection Testing Strategies](http://forum.ansible.com/t/6323))

---

<div class="post-metadata">

**Author:** ![thorian93](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thorian93/32/1320_2.png) [@thorian93](https://forum.ansible.com/u/thorian93)\
**Post date:** [June 12, 2024, 8:24pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/5 "2024-06-12T20:24:46Z")

</div>

Just my 2ct as someone who uses both `molecule` and `ansible-test` (and is curious about `tox-ansible`):  
For me molecule works very well with roles (in- or outside collections), especially as I can test against different operating systems at the same time (I am using Docker as well).  
However, when it comes to sanity and integration tests (we do not have unit tests as of now), I prefer `ansible-test`. I never troubled myself with thinking about how to use `molecule` for these tests, but it feels leaner to me this way and you usually do not need different operating systems there.

---

<div class="post-metadata">

**Author:** ![russoz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russoz/32/127_2.png) [@russoz](https://forum.ansible.com/u/russoz)\
**Post date:** [January 3, 2026, 10:17pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/6 "2026-01-03T22:17:56Z")

</div>

Hello everyone, reviving this topic because it is very relevant to the new community.openwrt collection.

The collection’s purpose is the management of OpenWrt devices, the usual testing target platforms are not useful. OTOH, there are official docker images of OpenWrt built for the `x86_64` architecture, which is perfect for us.

Whilst `ansible-test integration` gives us the right granularity to test each module, `molecule` gives us the ability of easily replicating the test for the docker images supporting multiple versions of OpenWrt. Recent versions of `molecule` support collections, with configuration files located by default at `extensions/molecule`.

See more of the discussion we had at:

> <https://github.com/ansible-collections/community.openwrt/pull/49>
>
> \##### SUMMARY
> 
> First attempt at running integration tests using \`molecule\`.
> 
> …
> The \*\*main purpose\*\* of this PR is not to test the \`command\` module, but rather to \*\*establish an integration test mechanism\*\* for this collection.
> 
> Usually, other collections will:
> \- be tested in a range of different OS'es running in VMs (managed in CI workflows) or containers (mostly managed by \`ansible-test\` itself).
> \- for each of these isolated runtime contexts, test one or more integration targets
> 
> In community.openwrt
> \- all integration tests run from one single OS (\`ubuntu-latest\` per the CI workflow)
> \- each target then runs \`molecule\` to load/configure/run the containers for different versions of OpenWrt.
> \- for each Ubuntu VM, it can run one or more instances of molecule (to be tested, maybe need to prevent collision for the container names)
> 
> 
> Fixes #8 
> 
> \##### ISSUE TYPE
> 
> \- Test Pull Request
> 
> \##### COMPONENT NAME
> 
> command

The outcome of that PR was integration tests using the same role-like structure, but a mandatory `runme.sh` script triggering the molecule test at the collection level, but using the integration test target as a role.

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [January 5, 2026, 10:34pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/7 "2026-01-05T22:34:33Z")

</div>

Hi @russoz

I saw your post [Integrating `ansible-test integration` (no pun intended) and `molecule`](https://forum.ansible.com/t/integrating-ansible-test-integration-no-pun-intended-and-molecule/45018) over the holidays but unfortunately I didn’t have a chance to reply until now. I’m interested in this topic and your approach to using `molecule` for integration tests in the `community.openwrt` collection because I initially looked at doing something similar for [GitHub - ansible-collections/community.beszel: Ansible content to automate the configuration of Beszel Hub and Agents.](https://github.com/ansible-collections/community.beszel) The Beszel project publishes a container image for the Beszel Hub and when I was initially looking to create the integration tests, I thought `molecule` would be an ideal fit. However, when I checked the documentation early on in my maintainer journey found that `ansible-test integration` is the method used for running integration tests.

I think this topic ties in with a comment made by @tima last year: [Your Feedback Wanted: The Ansible Collection Developer and Maintainer Journey - #4 by tima](https://forum.ansible.com/t/your-feedback-wanted-the-ansible-collection-developer-and-maintainer-journey/44592/4) - speaking to `ansible-test`:

> The tool was originally designed to test `ansible-core` , not collections. [As occasionally mentioned here for sometime](https://forum.ansible.com/t/error-invalid-extension-official-ansible-modules-must-have/5719/4), the long-term plan was for `ansible-test` to remain focused on core, with a separate tool emerging for the collection ecosystem.

@tima goes on further to mention:

> … [With an overhauled Molecule nearing completion](https://forum.ansible.com/t/help-test-molecule-v25-9-0-rc1-pre-release/44345), it might be a good time for the community to discuss updating the documentation to recommend Molecule as the standard tool for collection testing.

Now that `community.openwrt` is using `molecule` for collection integration tests, and I could implement similar for `community.beszel`, it’s probably worth discussing more in depth about how `molecule` could be used for collection testing (not just roles but for integration tests too), and maybe creating some convention around how that could look in a collection (repository / file structure) for molecule scenarios when wanting to use `molecule` for integration tests and get some documentation created around it.

Interested in your thoughts @russoz.

---

<div class="post-metadata">

**Author:** ![smags](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/smags/32/382_2.png) [@smags](https://forum.ansible.com/u/smags)\
**Post date:** [January 6, 2026, 3:03am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/8 "2026-01-06T03:03:27Z")

</div>

Watching this topic with interest as we have a collection that we should implement better testing on, i know the older versions of molecule could be a little cumbersome? Looking forward to re-visiting molecule to see how you have implemented the testing in those collections mentioned i.e. `community.openwrt` and `community.beszel`.

---

<div class="post-metadata">

**Author:** ![russoz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russoz/32/127_2.png) [@russoz](https://forum.ansible.com/u/russoz)\
**Post date:** [January 6, 2026, 6:20am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/9 "2026-01-06T06:20:00Z")

</div>

Hi @dbrennand

Happy 2026! 🙂 I think that is not a straightforward comparison/replacement that can be made, at least not in the way things are now.

`molecule` is more like a specialised tool (using very large quotes, a “lower level” kind of tool) compared with `ansible-test`. It has its degree of complexity, of course, but it is largely restricted to the “start container - run tests - destroy container” scenario.

Whereas in `ansible-test integration` you have things like: the fact that tests are roles, and the fact that all targets being roles, they can be easily reused by other tests (in community.general, see `test/integration/targets/setup_*`). Also, the `aliases` file, allowing some degree of control on how the CI interacts with that particular test. And `ansible-test` is aware of the distinction between Ansible controller and Ansible target nodes. Amongst other things.

Also, `molecule` has come caveats:

- the documentation in the official website, whilst covering most (if not all) of the switches and knobs individually, it is poor in examples of real life usage of its features, especially when testing collections. For role testing the documentation is better and there are many examples available by googling or directly searching withing github, but …
- … the framework has gone under a significant amount of changes in the recent couple of years. There is now this “ansible-native” way of expressing the configuration, which seems to be the new preferred way of doing so. However, most of the examples in the internet are based on the “old” configuration structure. Official docs fall short of providing real-life examples for this new model as well.

All that being said, in:

> <https://github.com/ansible-collections/community.openwrt/pull/49>
>
> \##### SUMMARY
> 
> First attempt at running integration tests using \`molecule\`.
> 
> …
> The \*\*main purpose\*\* of this PR is not to test the \`command\` module, but rather to \*\*establish an integration test mechanism\*\* for this collection.
> 
> Usually, other collections will:
> \- be tested in a range of different OS'es running in VMs (managed in CI workflows) or containers (mostly managed by \`ansible-test\` itself).
> \- for each of these isolated runtime contexts, test one or more integration targets
> 
> In community.openwrt
> \- all integration tests run from one single OS (\`ubuntu-latest\` per the CI workflow)
> \- each target then runs \`molecule\` to load/configure/run the containers for different versions of OpenWrt.
> \- for each Ubuntu VM, it can run one or more instances of molecule (to be tested, maybe need to prevent collision for the container names)
> 
> 
> Fixes #8 
> 
> \##### ISSUE TYPE
> 
> \- Test Pull Request
> 
> \##### COMPONENT NAME
> 
> command

We ended up creating a mixed solution: `ansible-test` integrated with `molecule`, using `pytest-ansible` as well. That solution has a lot of room for improvement as it is now, but it does allow us to have the best of both worlds. Better see the code in that PR than trying to explain it here.

Some things that we may change on that:

- parameterize the OpenWrt version, so that the matrix of versions can be controlled from GH workflows
- Maybe remove the pytest-ansible in the middle from the mix
- Try `pull-request-change-detection: true` in the GH action, so that not all tests are executed for every change
- Some way to run the tests locally against a live router (I am planning buying a new one for home, so the old one would become lab rat). Possibly an env var.

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [January 6, 2026, 10:29pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/11 "2026-01-06T22:29:31Z")

</div>

@russoz Thanks for your detailed response on this 🙂

> the fact that all targets being roles, they can be easily reused by other tests (in community.general, see `test/integration/targets/setup_*` ).

Yes, in `community.beszel` we have one called [`setup_hub`](https://github.com/ansible-collections/community.beszel/blob/main/tests/integration/targets/setup_hub/tasks/main.yml) which is re-used across different integration tests. I don’t think there is any reason from a technical standpoint for why this kind of `setup_*` role target for the collection’s integration tests couldn’t be implemented in a `molecule` scenario instead. 🤔

> the `aliases` file, allowing some degree of control on how the CI interacts with that particular test. And `ansible-test` is aware of the distinction between Ansible controller and Ansible target nodes.

AFAIK I don’t think `molecule` can do any of that, so if those are required for the collection integration tests then this is definitely a gap with `molecule` right now. Are you using any of that functionality from `ansible-test integration` for your collection integration tests in `community.openwrt` right now?

Now that I think of it, `community.beszel` is using `antsibull-nox` [`sessions.ansible_test_integration_w_default_container.core_python_versions`](https://github.com/ansible-collections/community.beszel/blob/main/antsibull-nox.toml#L42) which I believe under the hood runs `ansible-test integration` with specific Python versions.

It appears to me that maybe a wider community conversation about whether `ansible-test integration` is still the best tool / approach for collection integration testing, given that `molecule` has the new “ansible-native” design (as you mentioned). But that being said, there are some gaps which `molecule` might not be able to fill at this time.

> the framework has gone under a significant amount of changes in the recent couple of years. There is now this “ansible-native” way of expressing the configuration, which seems to be the new preferred way of doing so

The new “ansible-native” design with `molecule` IMO provides greater flexibility as you can have any Ansible tasks you want in the `create` or `prepare` sequences to be ran before the actual testing sequence (`converge`). Basically the equivalent of the integration `setup_*` targets. This includes having task files or roles (using `include_role`) which can be re-used across `molecule` scenarios. Please see below examples.

> However, most of the examples in the internet are based on the “old” configuration structure. Official docs fall short of providing real-life examples for this new model as well.

Completely agree with you here, the real-world examples are lacking right now using the new design but I’m thinking we could work together to improve the documentation around this? I’m assuming you have some examples in `community.openwrt` we could also reference in documentation?

I have some real-world examples in `community.beszel`:

1. [`extensions/molecule/common/create.yml`](https://github.com/ansible-collections/community.beszel/blob/main/extensions/molecule/common/create.yml) - The common create stage tasks. Deploys a Docker Compose stack and creates a container using `community.docker` collection modules.
2. [`extensions/molecule/common/beszel_public_key.yml`](https://github.com/ansible-collections/community.beszel/blob/main/extensions/molecule/common/beszel_public_key.yml) - Common tasks to get the Beszel Hub public key which is re-used in different `molecule` scenarios.

These are both re-used in the [`agent_default`](https://github.com/ansible-collections/community.beszel/blob/main/extensions/molecule/agent_default/create.yml#L2-L6) molecule scenario.

> - Maybe remove the pytest-ansible in the middle from the mix

Yes, I can see from a maintenance perspective that adding another dependency / tool to the collection could increase complexity and maintenance burden etc.

Hopefully I’ll have some time this week to look at your implementation in detail tying together `ansible-test`, `molecule` and `pytest-ansible` in `community.openwrt` - very cool! I’d also be interested in discussing whether that implementation could be further developed to become a newer / alternate method for collection integration testing, or we feedback tooling improvements so `molecule` can be used without the need for `pytest-ansible` being in the mix.

Appreciate your thoughts on this topic @russoz.

---

<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:** [January 7, 2026, 1:29pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/12 "2026-01-07T13:29:31Z")

</div>

> [@dbrennand](#):
>
> > the `aliases` file, allowing some degree of control on how the CI interacts with that particular test. And `ansible-test` is aware of the distinction between Ansible controller and Ansible target nodes.
> 
> AFAIK I don’t think `molecule` can do any of that, so if those are required for the collection integration tests then this is definitely a gap with `molecule` right now.

Could you please provide more details what molecule is missing? From this description I could not understand what is meant here.

> [@dbrennand](#):
>
> improvements so `molecule` can be used without the need for `pytest-ansible` being in the mix.

How one can use `molecule` with `pytest-ansible`? In the docs pytest is only mentioned in the context of parallel molecule scenario runs - which is not good idea if you cannot isolate molecule managed instances. I am using `molecule` quite extensively and I do not use nor `pytest` nor `pytest-ansible`,that is why I am wondering if I am missing something.

---

<div class="post-metadata">

**Author:** ![dbrennand](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dbrennand/32/7830_2.png) [@dbrennand](https://forum.ansible.com/u/dbrennand)\
**Post date:** [January 7, 2026, 10:31pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/13 "2026-01-07T22:31:44Z")

</div>

Hi @kks

> Could you please provide more details what molecule is missing? From this description I could not understand what is meant here.

Sure, I was referring to @russoz comment about `ansible-test` being able to do all the things below and I don’t think molecule can do all of of those:

> the `aliases` file, allowing some degree of control on how the CI interacts with that particular test. And `ansible-test` is aware of the distinction between Ansible controller and Ansible target nodes.

Although, thinking about this again now, I think `molecule` can make the distinction between the Ansible controller (which would be the host running `molecule` i.e `localhost`), and the managed node(s) would be the `molecule` managed instance(s) in the `molecule` managed inventory.

> How one can use `molecule` with `pytest-ansible` ? In the docs pytest is only mentioned in the context of parallel molecule scenario runs - which is not good idea if you cannot isolate molecule managed instances. I am using `molecule` quite extensively and I do not use nor `pytest` nor `pytest-ansible` ,that is why I am wondering if I am missing something.

Sorry for any confusion. This was referring to what @russoz and the other `community.openwrt` maintainers have implemented in [PR 49 - Integration test with molecule](https://github.com/ansible-collections/community.openwrt/pull/49). From my understanding of it, `ansible-test integration` sees the [`runme.sh`](https://github.com/ansible-collections/community.openwrt/blob/main/tests/integration/targets/command/runme.sh) in the integration target and executes it, that installs `molecule` and the Docker driver for `molecule`, it then uses `pytest` to run a fixture defined in [`conftest.py`](https://github.com/ansible-collections/community.openwrt/blob/main/tests/utils/integration/tests/conftest.py) which finally triggers the molecule scenario defined here: [community.openwrt/extensions/molecule/integration\_test at main · ansible-collections/community.openwrt · GitHub](https://github.com/ansible-collections/community.openwrt/tree/main/extensions/molecule/integration_test)

Do I understand that flow right @russoz?

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 8, 2026, 6:22am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/14 "2026-01-08T06:22:08Z")

</div>

One quite important feature of ansible-test integration that molecule doesn’t seem to support either is change detection, so that a PR only runs the integration tests that affect changed content. While this doesn’t matter for smaller collections, it is a huge problem for larger collections, or collections with slow test suites.

---

<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:** [January 8, 2026, 7:22am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/15 "2026-01-08T07:22:05Z")

</div>

> [@felixfontein](#):
>
> doesn’t seem to support either is change detection

Did you mean to say that GitHub action for ansible-test supports change detection, but for molecule “community” (or “official”) GitHub action is simply absent?

Or do you refer to ansibull-nox change detection feature?

[https://docs.ansible.com/projects/antsibull-nox/change-detection/](https://docs.ansible.com/projects/antsibull-nox/change-detection/)

> [@felixfontein](#):
>
> molecule doesn’t seem to support

And it should not support change detection. Detecting change could be done with github, git and probably other tools. For instance I archived that only some molecule test scenarios are executed by having github action that adds labels to pr for each role, module or plugin changed in that PR and another sets of actions - one for each role, module, plugin that run respective molecule scenarios if label is set (they can also be executed manually).

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 8, 2026, 7:46am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/16 "2026-01-08T07:46:39Z")

</div>

> [@kks](#):
>
> Did you mean to say that GitHub action for ansible-test supports change detection, but for molecule “community” (or “official”) GitHub action is simply absent?

No, I mean the change detection that is part of ansible-test (and has been there for many many years). It is also supported by the GitHub action for ansible-test, but the main driver is ansible-test itself.

---

<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:** [January 8, 2026, 9:38am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/17 "2026-01-08T09:38:35Z")

</div>

> [@felixfontein](#):
>
> the change detection that is part of ansible-test

Is there documentation how it works?

> **[Integration tests — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/dev_guide/testing_integration.html#testing-integration)**
>
> Topics

> **[tests/integration/targets/ - Testing collections — Ansible Community...](https://docs.ansible.com/projects/ansible/latest/dev_guide/developing_collections_testing.html#adding-integration-tests)**
>
> The main tool for testing collections is ansible-test, Ansible’s testing tool described in Testing Ansible and provided by both the ansible and ansible-core packages.

does not have anything related to change detection. Google only gives the link I provided to antsibull-nox.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 8, 2026, 11:31am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/18 "2026-01-08T11:31:18Z")

</div>

I don’t think there is any documentation, I only learned about how it worked by looking at the source and how it is used in the AZP CI scripts used in ansible/ansible and some collections.

---

<div class="post-metadata">

**Author:** ![russoz](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/russoz/32/127_2.png) [@russoz](https://forum.ansible.com/u/russoz)\
**Post date:** [January 8, 2026, 11:59am UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/19 "2026-01-08T11:59:34Z")

</div>

> [@dbrennand](#):
>
> From my understanding of it, `ansible-test integration` sees the [`runme.sh`](https://github.com/ansible-collections/community.openwrt/blob/main/tests/integration/targets/command/runme.sh) in the integration target and executes it, that installs `molecule` and the Docker driver for `molecule`, it then uses `pytest` to run a fixture defined in [`conftest.py`](https://github.com/ansible-collections/community.openwrt/blob/main/tests/utils/integration/tests/conftest.py) which finally triggers the molecule scenario defined here: [community.openwrt/extensions/molecule/integration\_test at main · ansible-collections/community.openwrt · GitHub](https://github.com/ansible-collections/community.openwrt/tree/main/extensions/molecule/integration_test)
> 
> Do I understand that flow right @russoz?

Yes. I am fully aware this is very convoluted, and this might get simplified later on.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 11, 2026, 7:17pm UTC](https://forum.ansible.com/t/should-we-be-using-molecule-or-ansible-test-for-unit-integration-tests/5539/21 "2026-01-11T19:17:19Z")

</div>

~~I’m not sure what you’re replying to. What you wrote seems completely unrelated to my post.~~

~~Your GHA workflow also doesn’t look like it will work.~~

(Post that this replied to was removed.)
