0
The jenkins test result GUI shows skipped or expectedFail tests as skipped. The individual test view for skipped or expectedFail tests shows "Skipped Message" and "Standard Output"
e.g. "Skipped Message" can be:
  • a custom skip message
        *  e.g. from python @unittest.skip("some reason") tag or 
        *  e.g. raise unittest.SkipTest("thing not found.")
  • "expected test failure"
  • "xfail-marked test passes unexpectedly"
http://doc.pytest.org/en/latest/skipping.html

We are using groovy script to generate test reports. We would like to include more information about skipped tests rather than just "skipped". How can we get info on the skipped test like in the "Skipped Message" in the GUI view?
The jenkins API is documented here:
https://javadoc.jenkins.io/plugin/junit/hudson/tasks/junit/TestResult.html

The answer is:
Call the undocumented test.getSkippedMessage() method. 
py.test writes skip message into junit xml. A tag like this inside the test result: 
That message can be a custom message from message in skip() call, or in case of xfail or xpass the message is set by pytest to "expected test failure" or "xfail-marked test passes unexpectedly".
jenkins junit plugin reads the junit xml. The message is available through the API here: class CaseResult getSkippedMessage() see https://github.com/jenkinsci/junit-plugin/blob/master/src/main/java/hudson/tasks/junit/CaseResult.java Although it is not documented here: http://hudson-ci.org/javadoc/hudson/tasks/junit/CaseResult.html

More questions in the jenkins PostBuild .groovy plugin area . . . .