Running TestLeft Tests From Jenkins

Applies to TestLeft 4.93, last modified on September 16, 2021

Jenkins is a build management application that allows automating repeating tasks, for example, obtaining source code from a source code control, building projects, testing applications and so on. Jenkins allows you to automate test runs as part of your build and test processes.

You can run TestLeft tests from Jenkins as other unit tests. However, before running tests, you need to configure your Jenkins nodes. This topic describes how to do it.

Configure Jenkins Nodes

Jenkins supports running distributed builds, so you can run your jobs on Jenkins nodes, which are remote machines where a Jenkins agent is running.

Before running your TestLeft tests from Jenkins, you need to prepare and configure the nodes where you want to run the tests:

  1. Launch a Jenkins agent on the needed nodes.

    We recommend that you launch your agents using Java Web Start. Launching them as a Windows service may cause issues.

  2. Start the TestLeft Restful service on the nodes.

Launch Jenkins Agent

Via Java Web Start
  1. Log on to the computer you want to use as a Jenkins node and open the http://<MasterName>:8080/computer/NodeName/ web page in the browser.

  2. Click Launch, or launch the slave agent using the command line provided by Jenkins.

    If you use the SessionCreator utility to run the service, you need to pass the /UseActiveSession parameter to prevent the utility from ending the current session and closing the Jenkins agent. See Running RESTful Web Service.
  3. To automate launching the agent via Java Web start, you can install Jenkins as a service from the agent application. To do this, launch it using the methods above and click File > Install as a service.

    Note: If you use TestComplete to play tests on a slave machine, remember that, under Windows 8 and later Windows versions, TestComplete needs elevated permissions by default. The Java Web Start agent application cannot start it with needed permissions, but the service can.

    Another option is to add the downloaded .jnlp file to startup (you will need to add the slave agent's certificate to trusted certificates) and enable auto-login following the MSDN instructions.

    In case you run the Jenkins slave agent automatically, make sure that the TestLeft web service starts before the test launch. To learn how to do it, see Running RESTful Web Service.
As Windows Service

To launch an agent in this way, you need to specify the name of the target computer, the user name and the password in the agent configuration. This approach does not require any preliminary setup on the target computer. However, this approach has several drawbacks:

Run TestLeft RESTful Web Service

To play back TestLeft tests, Jenkins nodes must have a running RESTful web service. In addition, an interactive user session must be open on it so that the test engine can interact with the GUI.

To meet these conditions, you can:

  • (Recommended for unattended test runs) Use the SessionCreator utility. It creates an interactive user session and launches the web service.

  • Run TestComplete or TestExecute with the REST API plugin enabled manually and not log out from the current session.

The SessionCreator utility is bundled with TestComplete, TestLeft, and TestExecute. You can find it in the <TestComplete/TestExecute/TestLeft>\Bin folder.

To run it, use the following command line:

SessionCreator.exe StartRestServer /UserName:user_name /Password:password [/UseActiveSession] [/RestServerPort:Port]

To learn more about the utility, see SessionCreator.

Requirements

By default, your Jenkins node may prohibit remote connections. If you want to open user sessions by using the SessionCreator utility, make sure the following requirements are met:

Enable Remote Desktop connections

  1. On your Jenkins node, set the System properties > Remote > Remote Desktop option to:

    • In Windows 10 and Windows 8 – Allow remote connections to this computer.

    • In Windows 7 – Allow connections from computers running any version of Remote Desktop (less secure).

  2. Add a user account under which you will run tests on a node to the Remote Desktop Users group.

  3. Make sure that the user account has a non-empty password.

Otherwise, Jenkins will not be able to connect to the remote machine and run tests on it.

Configure group policies

To be able to connect to a node and open a user session on it, configure the following group policies on the node:

  1. On your Jenkins node, open the Group Policy editor (type gpedit.msc in the Search dialog and press Enter).

  2. Disable the following policies:

    • Always prompt client for password upon connection

    • Prompt for credentials on the client computer

    To disable these policies

    If the computer belongs to a domain, you may need to ask your system administrator to disable these policies on the domain controller as well.

  3. If the node is running under Windows 10, enable the Require use of specific security layer for remote (RDP) connections group policy and set the security layer to Negotiate.

    To configure the group policy

  4. If the node is running under a non-server edition of Windows and it has other users logged in, log off those users.

  5. If the computer is running under a server edition of Windows, enable the following policy:

    • Require use of specific security layer for remote (RDP) connections (on Windows Server 2016 or Windows Server 2019)

    • Restrict Remote Desktop Services users to a single Remote Desktop Services session (on Windows Server 2012 or Windows Server 2008)

    • Restrict Terminal Services users to a single remote session (on Windows Server 2003)

    To enable the needed policy on Windows Server 2016 or Windows Server 2019

    To enable the needed policy on Windows Server 2008 and later

    To enable the needed policy on Windows Server 2003

    If the node is running in Remote Administration Server mode and there are user sessions opened on it, close unnecessary sessions.

  6. If the node is configured to show a logon message when a user logs on, disable the message.

    To disable the message

    If the message persists

You can check whether the Jenkins node is configured correctly by connecting to it manually. If it does not show any additional messages or prompts, the group policies are configured correctly. Otherwise, you may need to ask your system administrator to disable those messages.

Disable secure sign-in

Sometimes, Windows is configured so that the user has to press Ctrl+Alt+Delete before signing in to prevent unwanted actions the software that simulates user behavior may perform. We recommend that you turn it off:

  1. On the target PC, press Win+R to open the Run dialog.

  2. Type control userpasswords2 and press Enter.

  3. In the subsequent User Accounts dialog, switch to the Advanced tab.

  4. Unselect the Require users to press Ctrl+Alt+Delete option.

  5. Click OK or Apply.

Disable additional screens

To avoid issues during the testing, make sure that, when you connect to the remote machine, its desktop opens up immediately. That is, no additional screens appear (such as the login form, account selection window, or RDP Certificate Warning windows). To learn how to disable these additional screens, contact your IT department.

Provide elevated permissions for TestLeft

On Windows 8 and later, TestLeft requires elevated permissions for the run. Jenkins that is run through the Java Web Start agent application, cannot start TestLeft with required permissions, and will cause the test run to fail if it tries.

To run tests under Windows 8 and later, do any of the following:

  • Install the Java Web Start agent as a service. In this case, the agent has the required permissions and can start TestLeft.

– or –

  • Connect to the Jenkins node by using the "Let Jenkins control this Windows slave as a Windows service" launch method.

See Also

Running TestLeft Tests From Unit Testing Frameworks
SessionCreator
Writing Test Code (.NET)
Writing Test Code (Java)

Highlight search results