GIT is a source code management and revision control system. There are various version control systems are available, GIT has become very popular lately with its lots of enhanced features, ease to use, availability and speed. I am sure all of us also use some or another system to version control our automation scripts. In this post, we are going to focus on using GIT and how we can easily integrate with UFT.
I assume you are already well versed with GIT and its concepts. I will put a few basics here for a quick refresher. Get more details from GitHub help.
In this Post
GIT Basics
Let’s understand Version Control System first, a Version Control System allows you and your team to work on the same project simultaneously. It does not allow overwrite the changes and maintains a history of each change. There are two types of Version Control System
- Centralized Version Control System
- Distributed Version Control System
GIT is a Distributed Version Control System, it maintains a fully mirrored repository at the client which make it distributed and different from than a centralized one. If any of the servers goes down then a copy from the client be brought back to restore. Every checkout is the full backup of the repository.
GIT is Secure, Powerful, Easy to use, Fast and Free!
There are four main steps to work with GIT
- Modify a file in the working directory.
- Add files to the Staging area
- Perform Commit operation to move files from staging area.
- Perform Push Operation to store the changes permanently to the GIT repository
Let’s now get into step by step integration of UFT and GIT. we have used UFT 14 in this post.
Step 0: Install GIT and Create Account at GitHub
If you don’t have an account with GitHub, create an account at github.com
Download and install GIT on your System
Configure GIT, Open GIT Bash and run the below commands one by one
git config --global user.email "your email"
git config --global user.name "your user name"
Step 1: Create GitHub Repository
Log in to your GitHub account which you created, and create a new repository for your test. Here you can create a public or private repository. GitHub charges some amount for a private repository.
Follow these steps:
Step 2: Clone Repository to Local GIT
It is required to get your repository at GitHub to your local repository and linked. To do this you need to perform clone repository operation either at GIT GUI or GIT Bash.
- Create a folder on your system, say “C:\GIT”
- Launch GIT GUI and click on “Clone Existing Repository”
- Go to your GitHub and Copy the clone path for your repository, this path should be source location and the folder you created at your local should be the destination
- Click on Clone, and your local repository should be ready
Use commands below at GIT Bash to do the same, Navigate to the local repository directory before running these commands.
git init
git clone https://github.com/<Git Clone path>.git
Step 3: Create Test
Launch UFT and Create a test in the local repository path, i.e the same path where GIT repository has been initialized.
If you will notice in the solution explorer, a red exclamation mark has been added to all the file icon, which indicates that the files are currently in you local repository and not yet pushed to GitHub.
Step 4: Push Test to GitHub Repository
Two easy steps – Commit the changes and then push the changes. These options are available in the right-click menu on the test at Solution explorer. Push Option will be disabled at first, which means that you will need to commit the changes first.
at the bottom left you can see the status of the operation you perform.
refer the steps –
Once you have successfully pushed your changes to GitHub Repository, you can open the repository there and see the files from UFT test there.
What else operations can be performed from UFT?
Revert Changes: Use “Git Revert” to revert the changes back to the previous commit. UFT will close the test and open it again, all the changes since the last commit and push will be deleted.
Compare with the previous version: If you have made changes in the local repository, then you can compare the local repository test to the last commit using the “Compare with previous revision” option.
Use Bash for all other Operations: UFT does not provide a direct option for other operations like Create Branches or Merge Branches. You will use Bash for all such operations. from the UFT menu option, you should use “Open Bash” to launch GIT Bash and use commands
Create Branch: Use the command below to create a branch in the local repository, which will need to be pushed to GitHub.
Git checkout –b <New_Branch_Name>
Merge Changes to Master: To merge your changes to Master Branch at Repository, you will need to first check out the master and then merge the branch changes. use commands below
git checkout master
git merge <branch name>
Hope it was helpful, let us know if you have any further questions or any help required.
[…] our earlier post, we got to know the easy integration of UFT with GIT. This post focuses on integration of UFT and Jenkins. I have also tried to list down all the […]
Hi ,
I’m using uft 12.02 version i’did same above steps but not displaying any git commit or anything,Can you please helpme.
Very good article and Git works with UFT v14.
However, UFT takes a lot of time to load the tests as it is integrated with git. How to make it load quicker?
Thanks Anil. It may be because of the size and network speed. Can you try with relatively smaller tests
Quick question. I need GIT but do not want to be integrated with HPE UFT; its really slows the loading. Is there a setting/file where I can disable the GIT in UFT?
Usually it should not. You can always choose to Save to or open from a location which is not your GIT local repo. Copy the folders to another location at your local and open.
[…] phase development teams develops the Code. Which is being kept in source code repository such as GIT. As soon as the build (using Maven or Gradle etc) is triggered, automated tests get executed. This […]
Hi Saket,
Recently my team tried the Git integration with UFT. We were able to commit and push changes to individual changes to Git but the pain area is merging of UFT code to master or other branches. While merging there are many things we noticed:
a) the lock files of UFT are open all the time.
b) we could not merge the shared OR.
c) when we merge Function repos, we get invalid characters in the resulting file which are present in neither of the two files we merged.
d) looks like Git merges UFT code using line number; if there is a conflict on same line number, we need to resolve it manually.
Seeing these pain areas, we are thinking of dropping the idea of Git integration.
We have a whole team of 6 working on different branches and it is pain area for us to merge those individual codes.
Would you please take some time to point me in right direction for Git integration for UFT ?
Thanks in advance
Keshav