A quick guide to explain how to use the JustMock.Commercial package on Azure DevOps.
One of the main features of the JustMock.Commercial R3 2020 release is the possibility to deploy the JustMock profiler along with the mocking framework assemblies. This greatly improves the usability and fixes some of the drawbacks from previous versions. So far so good, but probably many of you would be curious about how this new feature can be used in Azure DevOps. With this post, I will try to give a short recipe in a few simple steps to make it work in your CI/CD pipeline.
For the purpose of the exercise we will use a minimal MSTest Unit Test project imported in the source repository:
The sample project is available on GitHub.
We also need a pipeline derived from the .NET Desktop task template. The initially generated VsTest task is replaced with JustMock Tests v2 task. Here it is:
Of course, the build definition above is just an example and you could continue to use your preferred approach for building pipelines, even with YAML.
Let us go through required configuration step by step.
<PackageReference Include="JustMock.Commercial" Version="2020.3.916.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
- task: NuGetCommand@2 displayName: 'NuGet restore' inputs: restoreSolution: '$(Parameters.solution)' feedsToUse: config nugetConfigPath: nuget.config externalFeedCredentials: 'Telerik NuGet Repo'
- task: vs-publisher-443.jm-vstest-2.JustMockVSTest-2.JustMockVSTest@2 displayName: 'VsTest - testAssemblies' inputs: pathTo64BitJustMockProfiler: '$(UserProfile)\.nuget\packages\justmock.commercial\2020.3.916.1\runtimes\win-x64\native\Telerik.CodeWeaver.Profiler.dll' pathTo32BitJustMockProfiler: '$(UserProfile)\.nuget\packages\justmock.commercial\2020.3.916.1\runtimes\win-x86\native\Telerik.CodeWeaver.Profiler.dll'
Now we are ready to run the pipeline.
All done, happy mocking!
Ivo Stoilov is a senior software engineer at Progress. He has 20+ years of experience with diverse technologies in variant roles. Outside of work, Ivo loves outdoor activities and exploring new places.
Subscribe to be the first to get our expert-written articles and tutorials for developers!