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.
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:
-
Install the Git or SVN client on the computer running UFT One.
-
Set up your Git or SVN workspace on your computer. For details, see your Git or SVN documentation.
-
In UFT One, create a test and save it in the folder configured to work with Git or SVN.
-
Add source files to your repository in Git or SVN using the standard GIT and SVN commands.
-
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.
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.
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 |
|
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.
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:
-
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.
-
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.
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.
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:
-
In the conflict list dialog that opens, select a file with repository conflicts.
-
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.
-
Commit the updated version.
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:
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.
|
Resolve conflicts
-
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).
- 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.
- When you finish resolving the conflicts, close the dialog box.
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.
- Perform right-click, select TortoiseGit -> Settings > Diff Viewer.
-
On the right pane of the Settings dialog box, click Advanced, and then in the Advanced diff settings dialog box, click Add...
-
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.
- Click OK in the dialog boxes, and click Apply on the right pane.
- Add the same settings for Merge Tool.
Resolve conflicts
-
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).
- 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.
- When you finish resolving the conflicts, close the dialog box.
Git branches
UFT One supports Git branches with the following commands
Create branch |
Create a new Git branch using the test currently open:
|
Switch branch |
Switch to the same test in a different Git branch:
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. |