Gradle - run tests and exports by pattern filter

At the moment the testOSGi task runs all bnd.bnd files as test and let me run a single test.
It would be great to have more control.

Is there any Option to run all osgitest/exports/resolve in gradle using an filter patter as it is possible in maven and bnd-cli?

./gradlew testrun.[myTestGlob.bndrun]
./gradlew export.[myExportGlob.bndrun]
./gradlew resolve.[myResolveGlob.bndrun]


I don’t think I understand your question. Just ask gradle to run the tasks you want to run. If you want to create a gradle task which depends on some subset of the predefined tasks, do it!

Let me try to explaine it a bit more clearly

As far as is know, in gradle, it is only possible to run a runtest task by its concrete name.
If I have >10 ‘test-xyz.bndrun’ files in my workspace i do not want to run it one by one by its name.

./gradlew testrun.testrun-1
./gradlew testrun.testrun-10

more handsome would be:
./gradlew testrun.test*.bndrun

An other issue is that if you have in each project of your workspace and ‘test.bndrun’ file. I can’t see a way to run an explicit test.bndrun of an specific project.

maybe all this is possible. but it did not find a way how to easiely run it.

You want a new gradle feature. You should ask gradle about that. Bnd cannot “fix” that.

You can use the full path of the task. For the p1 project, do ./gradlew :p1:testrun.test. This will run the testrun.test task in the p1 project.

1 Like