Just tried it and it does indeed work, but now IntelliJ asks each time I manually run a test which task I should run it with. It also adds another step when doing things like running with coverage.
Of course it asks, how should it know which task is the right one.
You could for example make a separate project for those tests, then IntelliJ should probably not need to ask which task to run.