Can I run Cycle from a remote machine without actively watching it?

Can I run Cycle from a remote machine without actively watching it?

Problem

One of the advantages of running Cycle scripts on a dedicated machine is the ability to execute the tests without inhibiting your ability to work locally. This article describes how to allow Cycle to successfully image match on a remote desktop while not being actively connected to the machine. This is especially useful if scheduling a suite of regression tests that utilize image matching.

Solution

In order for image matching to work even if you disconnect your remote desktop connection, you must keep your desktop active. The way to do this is by pointing your session to the console session. The console session is what you would see if you had a monitor hooked up to the server. When you connect to a machine via remote desktop from Windows server 2008 and beyond, you establish your session. By pointing your session to the console session, Cycle will still have a desktop to look at, as opposed to a black screen. 

Two ways you can point your session to the console session are:

  1. Manually via a Cycle Scenario
  2. Triggering Task Scheduler on User Disconnect

Manual Method

The manual solution requires adding a scenario to the beginning of your regression test. When executed, the tsconcommand will point your session to the console session and kick you off. If you were to run this and immediately reconnect, you’d notice that the screen is not black when attempting to image match.

  1. In order to create this scenario you will need the session id from your Remote Desktop session. To find this, with your remote desktop connected, open the command prompt and run the command query session:

    Query session

    This will return the Session Names and IDs of all open sessions. The one you will need is for your rdp-...session, (example underlined above).

  2. With this you can use the following scenario:

    Image Match Scenario

    Note: You will need to update the Step Then I enter "tscon 2 /dest:console" to replace the number 2 with the session id from the previous step.

One of the caveats of this method is you will need this scenario to run at the beginning of your testing if you would like to disconnect your remote session and keep image matching active. This means that you won’t be able to actively view the regression tests and disconnect from remote desktop as you please.

Task Scheduler Method

In order to be able to disconnect from remote desktop as you please and allow image matching to work successfully, you must schedule a task to execute a batch file that runs the same logic as the manual scenario.

  1. Launch task scheduler.
  2. Under task scheduler, select Create Task. Enter a NameDescription, and select Run with highest privileges.

    Task Schedule

  3. Create a trigger to begin the task On disconnect from a user session...Specific user. If you do not select this, you will get locked out of the server (upon reconnecting, this will execute and kick you back off).

    Task Scheduler Trigger

  4. Create an action to call a batch file.

    Task Scheduler Action

  5. The batch file is listed below. It runs the same logic manually run via command prompt. Replace Cycle with your user. You’ll find the log file in C:\Users\\AppData\Local\Temp.

    Image Match Batch File

Additional Note

In order for Cycle image matching to work properly on the console session, the resolution on the console session must equal the resolution used to capture the images. You can get and set the console resolution via Get-DisplayResolutionand Set-DisplayResolution <width> <height>. You must log out for this to take effect.


    • Related Articles

    • Getting Started with Cycle 2

      Log In to Cycle Cloud In order to get started with Cycle 2, you will need to sign up for a Cycle Cloud account, and then download Cycle 2 from Cycle Cloud. The sign up process requires you to verify your email address. Please note, the email address ...
    • Run Cycle as an Administrator

      Problem Some steps in Cycle, mainly native app interaction steps such as clicking or typing, may not reliably execute unless Cycle is being run as an administrator. Solution It is recommended that Cycle is always run as an administrator. NOTE: You ...
    • How To Find Windows AppID for Native App Steps (unable to create new remote session)

      Windows applications built using the Universal Windows Platform (UWP) API require Cycle to open the application using the AppID of the application rather than than specifying the executable application as needed when opening Classic Windows (Win32) ...
    • Can I use Cycle to run MSQL scripts?

      Problem More complex scripts can be long and hard to read or understand for less technical users. Breaking the overall flow and SOP use case of a Cycle Feature. Solution Short MOCA commands and local syntax statements can be built in-line with the “I ...
    • How To Access the Cycle E-Learning Platform (Cycle University)

      The Cycle User Portal was retired with the release of Cycle 2.9.2. The former Cycle E-Learning platform was retired along with the Cycle User Portal. Training materials can be found in the new Cycle University platform. Cycle Labs - Cycle University ...