Skip to content

Run RDP Server Test Suite on Multiple Platforms

Minghao Hu edited this page Jun 13, 2022 · 2 revisions

Contents

Test Environment Architecture

The Test Environment consists of a Driver computer (client) and SUT computers (server) in a workgroup environment.

Test Environment Configuration

Config System Under Test

Take a Windows SUT (computer name eg. RDPSrv-SUT01) as an example for the configuration description.

  1. Disable Firewall on the RDPSrv-SUT01
  2. Start Remote Desktop Services

Setup Driver Computer to Run Test Suite

Before config the Driver Computer and run test suite, please config and check the Driver Computer as below:

  1. Check the minimum requirement of a Driver computer

  2. Verify Network Computer Connectivity

Setup Driver Computer to run test suite with PTM

On Driver Computer, install the dependent software following: Windows Protocol TestSuites Prerequisite

Then install the latest released RDP Server test suite by downloading and extracting the zip file to local drive.

You can use the Protocol Test Manager to run test suite. More details about how to run test suite with PTM, please check the RDP Server User Guide

Setup a Linux Driver Computer to run test suite

There are 3 ways to setup a Linux Driver Computer to run test suite:

  1. Run test suite with released binaries
  2. Build and run test suite from scratch
  3. Run test suite in Docker image

Before run test suite, .NET SDK is required to be configured properly on the Linux Driver Computer.

  • Install .NET SDK

    wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    
    sudo apt-get update
    sudo apt-get install -y apt-transport-https
    sudo apt-get update 
    sudo apt-get install -y dotnet-sdk-6.0

Run test suite with released binaries

  1. Download test suite source released binaries from GitHub to /home/iolab

    wget https://github.com/microsoft/WindowsProtocolTestSuites/releases/download/4.21.1.0/RDP-TestSuite-ServerEP.tar.gz -L -O RDPServer.tar.gz
  2. Unzip test suite binaries

    mkdir RDPServer
    tar -C /home/iolab/RDPServer -zxvf /home/iolab/RDPServer.tar.gz
  3. Update the ptfconfig files

    Located at the local config path at /home/iolab/RDPServer/RDP_ServerTestSuite.deployment.ptfconfig. Update the RDP.ServerName with the SUT IP (192.168.142.21 for example) . Update RDP.ClientName with the current Linux Driver Computer (192.168.142.11 for example).

    <Property name="RDP.ServerName" value="192.168.142.21" />
    <Property name="RDP.ClientName" value="192.168.142.11" />
  4. Run test case under /home/iolab/RDPServer/Bin with the commands below for different binaries.

    dotnet test RDP_ServerTestSuite.dll --logger:"trx;LogFileName=RDPServerResult.trx"

Build and run test suite from scratch

You can also clone the source code and build by yourself. Here are the steps to follow:

  1. Clone source code from GitHub website to local driver, eg. /home/iolab/

    sudo apt install git
    git clone https://github.com/microsoft/WindowsProtocolTestSuites
  2. Update the ptfconfig files

    Located at the local config path at /home/iolab/RDPServer/RDP_ServerTestSuite.deployment.ptfconfig. Update the RDP.ServerName with the SUT IP (192.168.142.21 for example) . Update RDP.ClientName with the current Linux Driver Computer (192.168.142.11 for example).

    <Property name="RDP.ServerName" value="192.168.142.21" />
    <Property name="RDP.ClientName" value="192.168.142.11" />
  3. Build RDPServer test suite:

    During the build, PTF will be downloaded from NuGet website side-by-side.

    Build script:

    cd /home/iolab/WindowsProtocolTestSuites/TestSuites/RDP/Server/src
    build.ps1 Release published

    or

    cd /home/iolab/WindowsProtocolTestSuites/TestSuites/RDP/Server/src
    chmod +x ./build.sh
    ./build.sh Release published

    Note the first parameter for build script is the build environment(like Release, Debug) and the second parameter is the output folder

    After the build succeeds, the common folder structure should be generated in the folder /home/iolab/WindowsProtocolTestSuites/TestSuites/RDP/Server/src/published

    • Bin: all the built binaries including ProtoSDK, adapters and test suites.
    • Batch: batch files (.ps1, .sh) which can be used to launch tests.
    • Scripts: scripts which can be used to configure test environment.
  4. Run test suite with Batch

    In the Batch folder under root path of the test suite, there are several scripts you can use to launch tests.

    • Run all test cases

      Execute RunAllTestCases.ps1 in PowerShell, or RunAllTestCases.sh in shell directly.

    • Run test cases by filters

      Execute ./RunTestCasesByFilter.ps1 -Filter [your filter expression] in PowerShell, or ./RunTestCasesByFilter.sh [your filter expression] in shell directly.

      For example, you can run below command if you want to run test cases with test category BVT and RDPBCGR:

      ./RunTestCasesByFilter.sh "TestCategory=BVT&TestCategory=RDPBCGR"

      For more information about how to construct the filter expression, you can refer to Filter option details.

    • Dry run

      If you want to list the test cases before running them actually, you could add -DryRun switch to .ps1 scripts or pass a non-empty string as the last argument to .sh scripts.

      For example, you can run below command if you want to list test cases with test category BVT and RDPBCGR:

      RunTestCasesByFilter.sh "TestCategory=BVT&TestCategory=RDPBCGR" "list"

Run test suite in Docker image on Linux computer

Refer How-to-Run-Test-Suites-with-Docker for more details

  1. Install Docker

    sudo apt install docker.io
  2. Pull Docker image from Docker Hub

    sudo docker pull mcr.microsoft.com/windowsprotocoltestsuites:rdpserver
  3. Download ptfconfig file from GitHub Download the ptfconfig file from the GitHub link:

    https://github.com/microsoft/WindowsProtocolTestSuites/releases/download/4.21.1.0/rdpserver-docker-ptfconfig.tar.gz

    Unzip it to the local path of Linux host machine (/data/rdpserver for example) before ahead.

    wget https://github.com/microsoft/WindowsProtocolTestSuites/releases/download/4.21.1.0/rdpserver-docker-ptfconfig.tar.gz -L -O RDPServerPtfconfig.tar.gz
    
    mkdir RDPServerPtfconfig
    tar -C /home/iolab/RDPServerPtfconfig -zxvf /home/iolab/RDPServerPtfconfig.tar.gz
  4. Update the ptfconfig files

    Located at /home/iolab/RDPServer/RDP_ServerTestSuite.deployment.ptfconfig. Update the RDP.ServerName with the SUT IP (192.168.142.21 for example) . Update RDP.ClientName as the docker container VM name "RDPClient".

    <Property name="RDP.ServerName" value="192.168.142.21" />
    <Property name="RDP.ClientName" value="RDPClient" />
  5. Run the Windows protocol test suites image for RDPServer with parameters:

    docker run \
      --hostname RDPServer \
      --network host \
      -v /path/of/ptfconfig:/data/rdpserver \
      [optional]$filter \
      [optional]$dryRun \
      -i mcr.microsoft.com/windowsprotocoltestsuites:rdpserver \
    • --hostname: Required. The host name of the running container, for example: RDPClient
    • --network: Required. The network the running container will use, using host as default. While using host, please make sure that the connection between the host which the container is running and the server is valid.
    • -v: Required. The /path/of/ptfconfig should include all the ptfconfig files with pre-configured, and mount this path to the fixed path /data/rdpserver in the container
    • -i: Required. Keep STDIN open even if not attached.
    • $filter: Optional. The expression used to filter test cases. For example, "TestCategory=BVT&TestCategory=RDPBCGR" will filter out test cases with test category BVT and RDPBCGR.
    • $dryRun: Optional. If set as "y", just list all the test cases match the filter string instead of running them. If it's null or empty, the filtered test cases will be executed directly

    For example, the command below will run the test cases with category RDPBCGR.

    sudo docker run \
      --hostname RDPClient \
      --network host \
      -v /home/iolab/RDPServerPtfconfig/rdpserver-docker-ptfconfig:/data/rdpserver \
      -e Filter="'TestCategory=RDPBCGR'" \
      -e DryRun="" \
      -i mcr.microsoft.com/windowsprotocoltestsuites:rdpserver

Setup a macOS or Windows Driver Computer with Docker image to run test suite

  1. Install docker desktop version on your macOS or Windows Driver Computer, for Windows platform you need switch to Linux containers

  2. Pull image

    docker pull mcr.microsoft.com/windowsprotocoltestsuites:rdpserver
  3. Update the ptfconfig files

    Located at /home/iolab/RDPServer/RDP_ServerTestSuite.deployment.ptfconfig. Update the RDP.ServerName with the SUT IP (192.168.142.21 for example) . Update RDP.ClientName as the docker container VM name "RDPClient".

    <Property name="RDP.ServerName" value="192.168.142.21" />
    <Property name="RDP.ClientName" value="RDPClient" />
  4. Start the container by running the following command.

    docker run \
      --hostname RDPClient \
      -p 3389:3389 \
      -v C:\RDPServer\RDPServerPtfconfig\rdpserver-docker-ptfconfig:/data/rdpserver \
      -e Filter="'TestCategory=RDPBCGR'" \
      -e DryRun="" \
      -i mcr.microsoft.com/windowsprotocoltestsuites:rdpserver

    You will see output flows out to the host console, and the test result of the test cases filtered by the filter TestCategory=BVT&TestCategory=RDPBCGR will be found in your local config path when the execution is complete.

    Use below command then you can execute shell on docker container VM

    docker exec -it {image id} bash