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

PTMCli

PTMCli is a command-line tool for test automation of the Protocol Test Manager. It supports multiple operating systems including Windows, Linux and macOS.

Install

  • Download and install .NET 6.0 for your platform.

  • Download PTMCli.zip/PTMCli.tar.gz from the Releases page and extract the archive.

Syntax

cd <the folder that contains the extracted files>
dotnet PTMCli.dll <-p|--profile profilePath>
           <-t|--testsuite testSuitePath>
           [-s|--selected] [--filter filterExpression]
           [--config overriddenProperties]
           [-r|--report reportFile] [-f|--format plain,json,xunit]
           [--outcome pass,fail,inconclusive]
           [-d|--debug]
           [--help]
           [--version]

Parameters

-p|--profile profilePath

Specifies the path of the test profile to run.

To get a valid profile. You need to export one from PTM GUI. See Export Test Profile section.

-t|--testsuite testSuitePath

Specifies the path of the test suite to run.

-s|--selected

When specified, only the selected test cases will be executed. Otherwise, all the test cases in the profile will be executed.

--filter filterExpression

Specifies the filter expression of test cases to run. This parameter overrides the test cases in profile.

See Run selected unit tests for how to construct a valid filter expression.

--config overriddenProperties

Specifies the configuration items which will override the values in profile.

Each configuration should be in format {property_name}={property_value}, and multiple items should be separated by whitespace.

For example: --config "RDP.ServerPort=3389" "RDP.Security.Protocol=TLS"

-r|--report reportFile

Specifies the result file which will be written to. If not specified, test results will be written to stdout.

-f|--format plain,json,xunit

Specifies the report format.

Valid values are: plain, json, xunit.

Default value is plain.

--outcome pass,fail,inconclusive

Specifies the outcome of the test cases to be included in the report file.

Value should be separated by comma or space.

Valid values are: pass, fail, inconclusive.

Default value is pass,fail,inconclusive.

-d|--debug

When specified, PTMCli debugging is enabled. The log file can be found under the current directory where you run PTMCli.

--help

Display the help info.

--version

Display the version info of PTMCli.

Export Test Profile

As the below image shown, when using PTM to run test cases, in the last screen, click Export / Import at the right bottom of the test case list, then click Save Profile .... Then you can get a valid PTM profile to use with PtmCli.

Save a profile in PTM

Modify Test Profile

If you want to run test suite using a different configuration, you can modify the test profile.

The test profile (.ptm file) itself is actually a zip file. Unzip the .ptm file, you will get two folders: config and ptfconfig.

In config folder, you can edit playlist.xml to update playlist and edit profile.xml to update the selected rules.

And all ptfconfig file used by test suites are located in ptfconfig folder, you can change them accordingly.

When you are ready, zip the folder and modify the extension to .ptm. You can use the new test profile to run test suites using the new configuration.

Support multi-instance

PTMCli supports multi-instance, meaning that you can run multiple PTMCli at the same time.

For example, open two Console windows on Windows OS, and execute the commands below in each window.

dotnet PTMCli.dll -p C:\test1.ptm -t C:\FileServer-TestSuite-ServerEP
dotnet PTMCli.dll -p C:\test2.ptm -t C:\FileServer-TestSuite-ServerEP

You will get two results under C:\FileServer-TestSuite-ServerEP\HtmlTestResults\.