TcUnit.TestAdapter
0.0.3-beta
See the version list below for details.
dotnet add package TcUnit.TestAdapter --version 0.0.3-beta
NuGet\Install-Package TcUnit.TestAdapter -Version 0.0.3-beta
<PackageReference Include="TcUnit.TestAdapter" Version="0.0.3-beta" />
paket add TcUnit.TestAdapter --version 0.0.3-beta
#r "nuget: TcUnit.TestAdapter, 0.0.3-beta"
// Install TcUnit.TestAdapter as a Cake Addin #addin nuget:?package=TcUnit.TestAdapter&version=0.0.3-beta&prerelease // Install TcUnit.TestAdapter as a Cake Tool #tool nuget:?package=TcUnit.TestAdapter&version=0.0.3-beta&prerelease
TcUnit-VsTestAdapter
TcUnit-VsTestAdapter makes it possible to execute TcUnit (TwinCAT unit tests) with the Microsoft Visual Studio Test Plattform
For more details see vstest test adapter extensibility
Table of Contents
Usage
This section describes how to execute TcUnit tests in Azure DevOps pipelines or locally with Microsoft.TestPlatform.
vstest.console.exe
It is also possible to run TcUnit tests on a VM that has vstest.console.exe installed.
Setup Microsoft.TestPlatform on a VM
Let's assume that the working folder is C:\Tools
.
Download and install NuGet.
Install NuGet package Microsoft.TestPlatform
nuget install Microsoft.TestPlatform
Find vstest.console.exe
in C:\Tools\Microsoft.TestPlatform.16.7.1\tools\net451\Common7\IDE\Extensions\TestPlatform
.
Add this folder to the PATH environment variable.
Install TcUnit.TestAdapter
nuget install TcUnit.TestAdapter
You may now create a *.cmd / *.ps1 file, put it inside your TcUnit tests project and run it after compile
vstest.console.exe /TestAdapterPath:C:\Tools\TcUnit.TestAdapter.1.0.0\lib\netstandard2.0 /Settings:TcUnit.runsettings *\*.tsproj
See TwinCAT PLC Deployment for more information
Azure Pipelines
Add NuGet tool installer task to install NuGet.exe.
Example:
steps: - task: NuGetToolInstaller@0 displayName: 'Use NuGet' inputs: versionSpec: 4.4.1
Add NuGet task. Set command to
custom
and specify the command line:install TcUnit.TestAdapter -Version $(TcUnitTestAdapterVersion)
Example
steps: - task: NuGetCommand@2 displayName: 'NuGet Install TcUnit.TestAdapter' inputs: command: custom arguments: 'install TcUnit.TestAdapter -Version $(TcUnitTestAdapterVersion)'
In the pipeline settings set TcUnitTestAdapterVersion variable to the TcUnit.TestAdapter version you want to install (e.g. 1.0.0). The task will install TcUnit.TestAdapter into
$(Build.Repository.LocalPath)\TcUnit.TestAdapter.$(TcUnitTestAdapterVersion)\lib\netstandard2.0
If you plan to run tests on a self-hosted Windows Agent that does not have Visual Studio installed you need to add Visual Studio Test Platform Installer task.
Example:
steps: - task: VisualStudioTestPlatformInstaller@1 displayName: 'Visual Studio Test Platform Installer' inputs: versionSelector: latestStable
To run tests you need Visual Studio Test task.
Example:
steps: - task: VSTest@2 displayName: 'VsTest - Run TcUnit Tests' inputs: testAssemblyVer2: | $(Build.Repository.LocalPath)\Tests\*.plcproj runSettingsFile: '$(System.DefaultWorkingDirectory)\.ci\TcUnit.runsettings' pathtoCustomTestAdapters: '$(Build.Repository.LocalPath)\TcUnit.TestAdapter.$(TcUnitTestAdapterVersion)\lib\netstandard2.0' platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)'
Make sure that path to custom test set adapters is set to
$(Build.Repository.LocalPath)\TcUnit.TestAdapter.$(TcUnitTestAdapterVersion)\lib\netstandard2.0
Specify patterns to search for
*.plcproj
files in the test files section (testAssemblyVer2
in YAML).If you added Visual Studio Test Platform Installer task on the previous step do not forget to set
vsTestVersion
in YAML (or Test platform version in Classic UI):vsTestVersion: toolsInstaller
To publish test results (for later review and downloading) use Publish Build Artifacts task. Execution results are copied to
$(Agent.TempDirectory)\TestResults
.Example:
steps: - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: TestResults' inputs: PathtoPublish: '$(Agent.TempDirectory)\TestResults' ArtifactName: TestResults
Best Practice
Filter
TcUnit.TestAdapter supports filter
RunSettings
Use custom run settings
vstest.console.exe /Settings:path\to\TcUnit.runsettings
.runsettings file is used to pass parameters to the test run.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<TcUnit>
<Target>127.0.0.1.1.1</Target>
<Port>851</Port>
</TcUnit>
</RunSettings>
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform"
.\vstest.console.exe /TestAdapterPath:C:\Users\philipple\Desktop\TcUnit-VsTestAdapter\src\TcUnit.TestAdapter\bin\Release\netstandard2.0 /Settings:C:\Temp\TcUnit.runsettings C:\Temp\TcXaeProject\TcXaeProject\TcXaeProject.tsproj
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Beckhoff.TwinCAT.Ads (>= 6.0.0)
- Beckhoff.TwinCAT.Ads.Abstractions (>= 6.0.0)
- Microsoft.TestPlatform.ObjectModel (>= 17.7.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.0.5-beta | 121 | 9/3/2023 | |
0.0.4-beta | 105 | 9/3/2023 | |
0.0.3-beta | 121 | 9/3/2023 | |
0.0.1 | 182 | 9/2/2023 |