I am attempting to include test case passed, failed, skipped counts in Slack notifications from a Pipeline build but am having no success in accessing test results for a given build.
testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class)
This script does not fail but I get no results back. On inspection, I can see that currentBuild.rawBuild is always NULL.
I want to get the counts in this fashion:
def total = testResultAction.getTotalCount()
def failed = testResultAction.getFailCount()
def skipped = testResultAction.getSkipCount()
The approach below:
AggregatedTestResultAction testResultAction = currentBuild.rawBuild.getAction(AggregatedTestResultAction.class)
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getAction() is applicable for argument types: (java.lang.Class) values: [class hudson.tasks.test.AggregatedTestResultAction]
Any input on what I'm doing wrong here would be most appreciated.