UFT One 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 One.

Supported versions

For supported SVN and Git versions, see the Support Matrix.

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 One to work with Git or SVN

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

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

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

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

  4. Add 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 One.
    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. Depending on the Git version you are using, you may also need to remove the stored user credentials from your Windows account:

    Go to Control Panel -> User Accounts -> Credential Manager -> Windows Credentials and remove all Git credentials under Generic Credentials.

    Note: The Clear All Credentials (Git/SVN) option is available only if source files are under version control and credentials were previously saved.

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 or updates.

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 One.

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:

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: To clear your user credentials, see related information in Set up UFT One to work with Git or SVN.

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 One. 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 One:

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.

    Note: Function libraries saved as .qfl or .txt files support UTF-8 encoding. This enables you to compare, merge, and manage them in GIT.

    Function libraries saved as .vbs files, or saved in earlier UFT One versions, can be managed in GIT only as binary resources.

  3. (Optional, when committing to the remote repository) In the Solution Explorer, right-click the file and select Git Push.

    Git Push only updates the local repository to the remote repository. It will not add a new commit.

  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 so that you can perform a diff comparison in UFT One.

To perform a diff comparison of your source files in UFT One:

  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, such as UFT One Asset Comparison Tool.

  2. In the Solution Explorer, right-click the file name, and select Compare with Previous Revision or Git Diff.

    Note: The command available in the menu depends on the version control system you use.

    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 One 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 One 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.

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).

    To merge code files such as C# files, use the following syntax to specify the merge tool in the Version System pane:

    "Merge tool installation path" /base:%base /theirs:%their /mine:%mine /merged:%merged

    Currently, BeyondCompare is not supported for merging.

    Note: If you do not have a merge tool, the Merge option is not available. However, for object repository files, you can manually merge conflicts by following steps in Manually merge version conflicts of object repository files - SVN or Manually merge version conflicts of object repository files - Git.

  3. Commit the updated version.

Back to top

Manually merge version conflicts of object repository files - SVN

If you want to examine and manually merge conflicts between two object repository files in two different working folders, follow the instructions below:

Configure settings

Choose one of the following methods:

Method How to Configure Settings
Command line tool

Enter the following syntax in the command line tool:

"<UFT_One_installdir>\bin\QTPDiffApplication.exe" P1: "%base" P2: "%mine" FILE_TYPE: OR_FILE MERGED: "%merged folder"

Where P1 = file path to the base version, P2 = file path to your version, MERGED = file path to the final merged version. We recommend that you set the MERGED parameter to the value same as P1.

Note: Make sure you insert a blank space after each argument.

SVN settings

Configure Diff Viewer and Merge Tool

Note: You only need to configure the settings for the first time. If the path to the external tool changes, you need to remove the original settings and configure again.

  1. Perform right-click, select TortoiseSVN -> Settings > Diff Viewer.
  2. On the right pane of the Settings dialog box, click Advanced, and then in the Advanced diff settings dialog box, click Add...

  3. In the Add extension specific diff program dialog box, set the parameters below.

    Filename, extension or mime-type: Enter the file extension of object repository files, which is .tsr or .bdb.

    External Program: Click the button on the right to select the diff tool QTPDiffApplication and add " P1: %base P2: %mine FILE_TYPE: OR_FILE MERGED: %merged" to the end of the tool path.

    Where P1 = file path to the base version, P2 = file path to your version, MERGED = file path to the final merged version.

    Make sure you insert a blank space after each argument.

  4. Click OK in the dialog boxes, and click Apply on the right pane.
  5. Add the same settings for Merge Tool.

Resolve conflicts

  1. To merge two files:

    • Command line tool: Run the syntax in the table above.
    • SVN Settings: After you configure the settings, right-click a conflicted object repository file and select TortoiseSVN -> Edit conflicts.

    The Asset Comparison Tool dialog box opens, displaying the base version on the left (Remote) and your version on the right (Local).

  2. Examine each conflict and click the left Take Object from Remote button to use the base version or the Take Object from Local button to use yours.
  3. When you finish resolving the conflicts, close the dialog box.

Back to top

Manually merge version conflicts of object repository files - Git

If you want to examine and manually merge conflicts between two object repository files in two different branches, follow the instructions below:

Configure Git settings

Perform this one-time configuration of the Diff Viewer and Merge Tool.

If the path to the external tool changes, you need to remove the original settings and configure again.

  1. Perform right-click, select TortoiseGit -> Settings > Diff Viewer.
  2. On the right pane of the Settings dialog box, click Advanced, and then in the Advanced diff settings dialog box, click Add...

  3. In the Add extension specific diff program dialog box, set the parameters below.

    Extension: Enter the file extension of object repository files, which is .tsr or .bdb.

    External Program: Click the button on the right to select the diff tool QTPDiffApplication and add " P1: %base P2: %mine FILE_TYPE: OR_FILE MERGED: %merged" to the end of the tool path.

    Where P1 = file path to the base version, P2 = file path to your version, MERGED = file path to the final merged version.

    Make sure you insert a blank space after each argument.

  4. Click OK in the dialog boxes, and click Apply on the right pane.
  5. Add the same settings for Merge Tool.

Resolve conflicts

  1. After you configure the settings, right-click a conflicted object repository file and select TortoiseGit -> Diff with previous version.

    The Asset Comparison Tool dialog box opens, displaying the base version on the left (Remote) and your version on the right (Local).

  2. Examine each conflict and click the left Take Object from Remote button to use the base version or the Take Object from Local button to use yours.
  3. When you finish resolving the conflicts, close the dialog box.

Back to top

Git branches

UFT One supports Git branches with the following commands

Create branch

Create a new Git branch using the test currently open:

  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 One re-opens the test from the new branch. If this option is not selected, UFT One opens the test again from the same branch you started in.

Switch branch

Switch to the same test in a different Git branch:

  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 One re-opens the test from the selected branch.

Merge branches

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

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

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

Back to top