Your listener should be on test classpath and not on build script classptath. You should use the snippet from your original post to register the listener and move the listener class to test source set.
Can you explain a little more. I don’t understand second sentance at all. And correct me if I understood your first sentance: compiled classes from buildSrc folder are including into buildScript classpath of my build.gradle, but not on test classpath.
Yes, you understood the first sentence correctly. The second sentence means that you need to move your listener class from buildSrc to src/test/java. That’s where your test source set would live if your project follows the convention.
Yeah, so the solution is to move listener in to the package with my tests!
But still there is a little trouble, I am having a multi-project, so it was usefull for me to declare it once somewhere, but not duplicating the code everywhere. Now because of this I have three choises: 1) Duplicate Listener codes for all subprojects 2) Make a project with the listener and make a dependency for all subprojects, to compile Listener-project 3) Put it to some existed project, and make dependencies for other subprojects.
The best solution would be probably to create a new subproject that will only contain that listener and then add the following dependency to all subprojects that need the listener:
By the way is there a set of options that needs to be specified for Listeners? I am specifing only ‘outputDirectory’ - as a path to folder with results. Well and listeners ofcourse.
I was thinking that gradle will take as default all testCases, but seems it’s not.
Will try to handle this for my own. But would be good if somebody will ahead me, and explain which are defenetly should be specified