Saturday, June 4, 2022

Azure DevOps - Unit Test Case Pipeline

Unit Testing

Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. This testing methodology is done during the development process by the software developers and sometimes QA staff.

Below are the steps to add unit test in Azure pipeline

  • Open an existing project in VS and add a new project (right-click on Solution and select Add ---> NewProject-->UnitTest for .NetCore) 
  • Add the code for unit Test and commit in the local repository and push it to remote Azure Repos.
  • Create an Azure pipeline to refer above repository and add the below code for the unit test task.

  1. - task: DotNetCoreCLI@2
  2.   inputs:
  3.     command: test
  4.     projects: '**/*Test/*.csproj'
  5.     arguments: '--configuration $(buildConfiguration)'

  • Save and Run the pipeline.
  • Once the pipeline is executed successfully then check the Job summary and you will find the Test tab and you can see the test result in the pipeline


Post a Comment