title: Run tests in Azure DevOps Build Pipeline
body: <p>I would like to make a build pipeline in Azure DevOps including tests/code coverage.</p>
  
  <p>For that, I created a very basic Java project:</p>
  
  <pre><code>package main:
      - main class
      - Calculator class
            - add method
  package test:
      - CalculatorTest class
          - addTest method
  </code></pre>
  
  <p>It's very basic, just for me to understand how test in pipeline work. I don't use maven or things like that. For the tests, I'm using JUnit framework.</p>
  
  <p>In Azure DevOps pipeline, I imported my project from Github, and started to create the pipeline. I start from the starter template, which contains:</p>
  
  <pre><code>trigger:
  - master
  
  pool:
    vmImage: 'Ubuntu-16.04'
  
  steps:
  - script: echo Hello, world!
    displayName: 'Run a one-line script'
  
  - script: |
      echo Add other tasks to build, test, and deploy your project.
      echo See https://aka.ms/yaml
    displayName: 'Run a multi-line script'
  </code></pre>
  
  <p>My question is:</p>
  
  <p>What do I have to do to run my tests automatically ? </p>
  
  <p>I've seen several examples on the Microsoft documentation but it was always for "complex" projects (like with maven etc.). And ass I'm new with Azure DevOps and YAML file/syntax, I'm lost.</p>
  
  <p>I want to run my tests after each commit, and see the results (test + code coverage) in the pipeline summary, like it is described here : <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops#view-test-results-in-build" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops#view-test-results-in-build</a></p>
  
  <p>Thanks a lot.</p>
  
  <p>PS: For the moment I'm just focusing on tests but once it will be done I also would like to publish build artefacts. I would like the confirmation of that: </p>
  
  <pre><code>- task: PublishBuildArtifacts@1
  </code></pre>
  
  <p>Is that line correct ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The line <code>- task: PublishBuildArtifacts@1</code> seems to work correclty but I have the following warning:</p>
  
  <pre><code>Directory '/home/vsts/work/1/a' is empty. Nothing will be added to build artifact 'drop'.
  </code></pre>
  
  <p>What does it mean ? </p>