Get the list of the tests of the projects

Hello
I’m with gradle 5, I need to get the list of the tests to execute in my project.
I use the following code:

test.getCandidateClassFiles()

But it every time gives me back en empty object.
Does anyone know how to do so ?