Created
September 28, 2017 14:41
-
-
Save tizki/175ff0769584afd5bb65ef19d7776c54 to your computer and use it in GitHub Desktop.
prints test class FQDN name and its duration in seconds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.tasks.test.AbstractTestResultAction; | |
import hudson.tasks.junit.ClassResult; | |
import hudson.tasks.test.TabulatedResult; | |
import hudson.tasks.test.TestResult; | |
def jenkins = Jenkins.instance | |
def job = jenkins.getItem("your job") | |
def buildNum = 123 | |
def bld = job.getBuildByNumber(buildNum) | |
//println bld.actions | |
def testResults = bld.getAction(AbstractTestResultAction.class) | |
def testData = testResults.getResult() | |
println testData instanceof TabulatedResult | |
TabulatedResult tr = (TabulatedResult) testData; | |
for (TestResult child : tr.getChildren()) { | |
for( hudson.tasks.junit.ClassResult cr: child.getChildren()){ | |
println "${child.packageName}.${cr.className}, ${cr.duration}" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment