UFT and version control systems

Relevant for: GUI tests, API tests, and function libraries

Work with version control systems, such as SVN or Git, directly from UFT.

Supported versions

If you are using SVN, you must use SVN version 1.8.x. If you are using Git, use the Git client version 2.5.2 or later.

If your source files are saved in an ALM project or a version-controlled ALM project, see Version control in ALM.

Back to top

Set up UFT to work with Git or SVN

Before using Git or SVN inside UFT you must configure Git or SVN locally:

  1. Install the Git or SVN client on the computer running UFT.

  2. Set up your Git or SVN workspace on your computer. For details on see your Git or SVN documentation.

  3. In UFT, create the test and save it in the folder configured to work with Git or SVN.

  4. Add the source files to your repository in Git or SVN using the standard GIT and SVN commands.

  5. When prompted, enter your user credentials:

    SVN You are prompted for your user credentials the first time you add, update, or commit to an SVN repository from UFT.
    Git You are prompted for your user credentials the first time you push to the remote repository.

    To clear user credentials, select Tools > Clear All Credentials (Git/SVN). You'll be prompted to enter them on the next update or commit.

After setting up the workspace and adding source files, relevant icons are added to your testing nodes in the Solution Explorer. From then on, you can use SVN and Git commands directly from the Solution Explorer.

Note: With large solutions and slow networks, the SVN and Git icons may take a few moments to appear.

In such cases, you’ll need to wait until the icons refresh to perform commits, updates, and so on.

Back to top

Update changes for a source file

Update changes directly from the Solution Explorer.

Only source files that stand alone - those not dependent on a parent file, like an action to a test - can be updated directly from UFT.

For example, if you want to update changes from one action in a test or a local object repository in a test, you must commit the test.

To update a source file, do the following:

SVN Right-click the file name (or the parent file name), and select Update.
Git

Make sure that the folder containing the file is synced with the Git repository.

Right-click the file name and select Git Pull.

Note: If you need to clear your user credentials, select Tools > Clear All Credentials (Git/SVN). Your user credentials for the SVN or GIT repository are removed and you will be prompted to enter them on the next update or commit.

Back to top

Commit changes for a source file

Commit changes directly from the Solution Explorer.

Only source files that stand alone - those not dependent on a parent file, like an action to a test - can be committed directly from UFT. For example, if you want to commit changes from one action in a test or a local object repository in a test, you must commit the test.

To commit changes, do the following after creating the file in UFT:

SVN

In the Solution Explorer, right-click the source file (or parent file) name and select Commit.

Git
  1. Make sure that the folder containing the file is synced with the Git repository.
  2. In the Solution Explorer, right-click the file and select Git Commit. This adds the source file to the local repository (if necessary) and commits the changes.

    You can commit only tests and external resource files (like a function library, object repository, or recovery scenario to a repository.

  3. (Optional, when committing to the remote repository) In the Solution Explorer, right-click the file and select Git Push.
  4. In the dialog that opens, enter your personalized commit message. If you leave the field blank, the default message UFT commit is used.

Note: If you have external source files associated with a test (such as an external action or a function library), the external files are not saved and committed when you commit the test. You must save the external files separately.

Back to top

Compare a source file with the repository version

Specify your diff tool, such as the UFT Asset Comparison Tool.

These tools are specified in the Version Control Systems pane of the Options dialog box (Tools > Options > General tab > Version Control Systems node).

Do the following to perform a diff comparison of your source files:

  1. In the Version Control System pane of the Options dialog box (Tools > Options > General tab > Version Control Systems node), specify a diff tool for each type of file.

  2. In the Solution Explorer, right-click the file name, and select Diff with Previous Version.

    The selected diff tool opens, enabling you to perform your diff comparison.

Back to top

Revert a source file

Right-click the file name in the Solution Explorer, and select Revert. UFT reloads the previous version as saved in the local copy of the repository and your changes are removed.

Back to top

Resolve conflicts between file versions

When there are conflicts between source file versions, UFT displays a dialog listing the conflicts, and enables you to choose which version of the file to save. You can also merge two versions of the file if necessary.

Do the following to resolve the conflicts:

  1. In the conflict list dialog that opens, select a file with repository conflicts.

  2. At the bottom of the dialog, choose one of the following options:

    Use My Changes Saves the changes you made to the file and overwrites the version saved in the repository.
    Use Their Changes Takes the version in the repository and overwrites your changes.
    Merge

    Merges both versions together.

    You must define a specific tool for merging in the Version System pane of the Options dialog box (Tools > Options > General tab > Version System pane).

    View in Explorer Open the folder containing the file, where you can manually modify the conflicts.
  3. Commit the updated version.

Back to top

Git branches

Supported in UFT versions 14.51 and higher

UFT supports Git branches with the following commands

Create branch

Create a new Git branch using the test currently open.

Do the following:

  1. In the Solution Explorer, right-click the test, and select Git Create Branch.

  2. Enter a new branch name, and select the base branch, such as master.

  3. Optionally, select to automatically switch to the new branch.

    If this option is selected, UFT re-opens the test from the new branch. If this option is not selected, UFT opens the test again from the same branch you started in.

Switch branch

Switch to the same test in a different Git branch.

Do the following:

  1. In the Solution Explorer, right-click the test, and select Git Switch Branch.
  2. Select the branch you want to switch to, and whether you want to overwrite the working tree with your local changes.

UFT re-opens the test from the selected branch.

Merge branches

Merge data from a different branch into the branch currently open in UFT.

In the Solution Explorer, right-click the test, and select Git Merge Branches.

Your data is merged into the selected branch. UFT re-opens your test in the same branch you started in from before the merge.

Back to top