TcUnit.TestAdapter 0.0.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TcUnit.TestAdapter --version 0.0.1                
NuGet\Install-Package TcUnit.TestAdapter -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TcUnit.TestAdapter" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TcUnit.TestAdapter --version 0.0.1                
#r "nuget: TcUnit.TestAdapter, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TcUnit.TestAdapter as a Cake Addin
#addin nuget:?package=TcUnit.TestAdapter&version=0.0.1

// Install TcUnit.TestAdapter as a Cake Tool
#tool nuget:?package=TcUnit.TestAdapter&version=0.0.1                

TcUnit logo GitHub license Open Source? Yes!

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.

  1. Download and install NuGet.

  2. 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.

  1. Install TcUnit.TestAdapter

    nuget install TcUnit.TestAdapter
    
  2. 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 *\*.plcproj
    

    twincat-deployment.png

    See TwinCAT PLC Deployment for more information

Azure Pipelines

  1. Add NuGet tool installer task to install NuGet.exe.

    Example:

    steps:
    - task: NuGetToolInstaller@0
      displayName: 'Use NuGet'
      inputs:
        versionSpec: 4.4.1
    
  2. 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
    
  3. 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
    
  4. 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
    
  5. 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
    

Test Filter Cirteria

TcUnit.TestAdapter supports filter criteria

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>
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 125 9/3/2023
0.0.4-beta 107 9/3/2023
0.0.3-beta 123 9/3/2023
0.0.1 193 9/2/2023 0.0.1 is deprecated because it is no longer maintained.