Playback

Running workflows

Running workflows from the studio

Requirements

  • Started server
  • Started and connected studio
  • Started and connected agent that fulfills capabilities required by the workflow
  • Required components (e.g. a browser) have to be installed on the machine it is running on

_images/WorkflowAusfuehren.png

_images/Icon1.png The button to start execution of a workflow

_images/Icon2.png The active tab - the workflow that will be executed

To run a recorded, manually built or saved workflow from the studio, you need to open the specific workflow or activate its tab if it’s opened already. Now you can run it by simply clicking on the “run”-button in the upper toolbar of the studio.

The studio will now - before running the workflow - check if there is an agent it can reservate or enough licenses are available. Should the studio find that it is not able to run this workflow - either because all agents are already in use, no agents are connected or you don’t have enough licenses - you will get a specific error message in the test results toolbar showing you what exactly went wrong.

If one agent (or more - if needed) has been reserved for execution, this workflow will now be run on it. The specific activity that is being executed will be marked by colored border - so you can know exactly what part of the workflow is being executed.

While the execution is running, you will have no way to edit the workflow inside of the tab that is being executed - neither by editing properties or by trying to record somethign into it - you have will to wait for the end of exection or manually stop it by clicking on the “stop”-button.

Record errors during playback

Web activities have the configurable property to take a screenshot of the browser as they fail. If you have activated this setting and execute a workflow and one of the activities fails, you have the option to export this screenshot via a test report.

Export test-report


Running Playlists

Requirements

  • TWS is installed
  • Server is started
  • Agent is started
  • Playlist has been created
  • Required applications are installed (e.g. specific browsers)

You can run playlists using the test adapter or the command line interface.

  • How to create playlists?
  • How to configure the test adapter and command line interface?

Test Adapter

The TestWorkflow test adapter runs workflows contained in a project or a project collections to automate the running of tests. By using workflow-playlists you can define the workflows that are to be run in later test-runs.

This part discusses how to run a Test Workflow Playlist: locally via the VSTest.Console and automatically using the Team Foundation Server (TFS)

_images/warning.png Warning:

To execute test workflows, a Test Workflow Server must be available, since it is responsible for executing the workflows. Please note that a certain number of agents should always be available so that they can be used for the automated tests..

Execution via VSTest.console

Test workflows can be executed locally via the VSTest.Console.exe, which is usually located at the following path:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\VSTest.Console.exe

The path of the Test Adapter and the Test Workflow Playlist must be passed as argument.

VSTest.Console.exe /TestAdapterPath:<PathToTestAdapter> "C:\TestSolution\TestProject\Tests\bin\Debug\Tests.twp"

In addition, a host name or Uri can be specified on which a test workflow server runs and can be used for test execution. By default, localhost is used as hostname.

VSTest.Console.exe /TestAdapterPath:<PathToTestAdapter> "C:\TestSolution\TestProject\bin\Debug\Tests.twp" -- ServerAdress="TWS-Server-01"

_images/warning.png WARNING:

Both the playlist and the workflows must be copied to the output directory during the build process.

All workflows specified in the playlist are then executed.

Execution via the Team Foundation Server

The Team Foundation Server build process provides the ability to automatically call the test adapter and execute workflows. To do this, the Visual Studio Test Task must be added to the current build definition.

_images/BuildTasks.png

The task is then configured. A wild card can be used as a test assembly path. All *.twp files in the specified directory are automatically searched for and executed.

_images/TestAssemblyWildCard.png

In order for the test execution to start, the task still needs the host name of the TWS server.

_images/ServerAddress.png

Command line interface

The command line interface offers another way to run workflows contained in a playlist. To run test workflows, the cli has to be run with arguments.

Arguments

-twp <PATH_TO_PLAYLIST>

Always indicate a Workflow-Playlist that contains the worklfows you want to executed. (Bsp.: tws-cli.exe -twp C:\user\documents\playlist.twp)

-server <SERVER_ADDRESS>

You can specify a address where the Test Worklfows Server is running. If you specify no address then the address “localhost” will be used. (Bsp.: tws-cli.exe -server 192.168.0.1)

-o <OUTPUT_PATH>

You can specify the path, at which the test results will be written. The default path is the path at which the tws-cli.exe is located. (Bsp.: tws-cli.exe -o C:\user\documents)

-nane

You can specify the name with which the Test Workflows CommandLineInterface registers itself at the Test Workflows Server. (Bsp.: tws-cli.exe -name HITC)

-timeout

You can specify a timeout in seconds after which the execution of the workflow will be aborted. (Bsp.: tws-cli.exe -timeout 10)