I forgot to mention that the async service I want to test is launched
with a EECA, upon an entity creation, with mode="async".
Le 11/09/2025 à 08:32, Florian Motteau a écrit :
Hi all,
I'm writing service tests, in the same way as what's done in
ProductPromoCondTests.groovy. I load same data, then start a service
using dispatcher.runSync, and finally, check my database state.
I would like to be able to test services that are launched with
runAsync in my codebase. For now I can only check that the service is
scheduled (checking JobSandbox), but I guess that my test ends before
the async service is started (and I'm not even sure how to wait for a
spawn thread in my test).
I tried to replace "runAsync" calls by "runSync" using Mockito's spy()
and doAnswer, but I could not achieve what I need (I'm certainly
missing something here).
Has anyone ever encountered this need and could share a solution ?
Beside this, I would like to be able to run on specific test with CLI.
For now I launch
./gradlew 'ofbiz -t component=stock -t suitename=stockTests -t
case=stockTests'
...which runs all the tests in StockTests.groovy class. Is it possible
to update this command to run only one test in this class ?
Thank you
--
Néréide <http://nereide.fr/>
Florian Motteau
Co-entrepreneur Néréide
informat...@nereide.fr
8 rue des Déportés 37000 TOURS
Std: 02 47 50 30 54
www.nereide.fr <https://nereide.fr/>
Réseau Libre-Entreprise <https://www.libre-entreprise.org/>