title: How to access Junit test counts in Jenkins Pipeline project
body: <p>I have just started with Jenkins</p>
  
  <p>My freestyle project used to report JUnit tests results in Slack like this</p>
  
  <pre><code>MyJenkinsFreestyle - #79 Unstable after 4 min 59 sec (Open)
  Test Status:
      Passed: 2482, Failed: 13, Skipped: 62
  </code></pre>
  
  <p>Now I have moved the same to pipeline project, and all is good except that Slack notifications do not have Test Status</p>
  
  <pre><code>done MyPipelineProject #68 UNSTABLE
  </code></pre>
  
  <p>I understand I have to construct the message to send to Slack, and I have done that above for now.</p>
  
  <p>The only issue is how do I read the test status - the passed count, failed count etc. 
  This is called "test summary" in Jenkins slack-plugin <a href="https://github.com/jenkinsci/slack-plugin/pull/25">commit</a>, and here is the screenshot
  <a href="https://i.stack.imgur.com/Pji8u.png"><img src="https://i.stack.imgur.com/Pji8u.png" alt="testsummaryimage"></a></p>
  
  <p>So how do I access Junit tests count/details in Jenkins Pipeline project ? - so that these are reported in notifications.</p>
  
  <p>UPDATE:
  In the Freestyle project, the Slack notification itself has the "test summary", and there is no option to opt (or not) for the test summary.</p>
  
  <p>In Pipeline project, my "junit" command to "Publish JUnit test results" is before sending Slack notification.</p>
  
  <p>So in code those lines look like this (this are last lines of the last stage):</p>
  
  <pre><code>bat runtests.bat
  junit 'junitreport/xml/TEST*.xml'
  slackSend channel: '#testschannel', color: 'normal', message: "done ${env.JOB_NAME} ${env.BUILD_NUMBER} (&lt;${env.BUILD_URL}|Open&gt;)";
  </code></pre>