Listen to Gradle Tasks and TestNG Tests
I'm building an IDE activity tracking plugin for my introductory CS course. At this point I'm successfully logging a bunch of UI-related events. However, I'd like to log when students run tests and a Gradle grading task that we provide them with to better understand their workflow.
I've tried using TestStatusListener but either (a) I'm not subscribing to it correctly or (b) the events aren't firing. Note that we're using TestNG for our tests, not JUnit. Maybe that's a problem.
For Gradle I was able to see events triggered using the ExternalTaskManagerListener (or something like that). However I'm not sure how to get the project context or more information about the task that's being run from the event that's passed. Most receivers in that API seem to only get a task ID, which I'm assuming can be used to retrieve more information but I'm not sure exactly how.
Thanks in advance for any help. IntelliJ is fantastic!
Please sign in to leave a comment.
So to start answering my own question: I was able to get the TestStatusListener to work by following an example I found here: https://github.com/Dynatrace/Dynatrace-AppMon-IntelliJ-IDEA-Integration-Plugin/blob/master/src/main/java/com/dynatrace/integration/idea/execution/DynatraceTestStatusListener.java. So that's working. And at least for now watching the Gradle runs isn't necessarily a high priority.
It still seems like the various sources of information in IntelliJ could be (much) better documented. And there seem to be at least two if not three ways of receiving information: registering in the plugin.xml file and implementing a listener interface, or using the message bus at either the application or project level. This adds to the confusion.