Why do we use source control or version control?
Let’s say by mistake we made some changes to a test and we want to revert back to the original state or imagine if the system crashed and we lose all our codes/tests. It is also useful if you have different environments and you need to maintain different versions of the same test. These are few examples which advocate the importance of source control.
Test Studio integrates with Source control system like Microsoft Team Foundation Server quite easily. The integration helps different QA automation team members to check-in their tests at the same time and independently.
How to connect test project to TFS?
First select the project by a single click on it, in the Test Studio and then click on the connect button.
It will open Connect to Source Control pop-up with two options, TFS and GIT. TFS allows you to use both TFS and GIT for source control. But we will restrict to TFS for the scope of this tutorial.
From the listed source control types, select TFS and click on OK button to proceed.
Enter all details.
- Provide virtual directory address for your TFS account.
- Check the connection type if its HTTP or HTTPS
- Provide collections name
- Give your TFS server name without prefixing HTTP or HTTPS, Telerik automatically adds http or https based on your selection of the radio button.
- Provide Port
Once you have entered all details, click on Connect. Test Studio will connect to TFS and will display a list of available directories in the “TFS Project” text area.
So, here we have a location named as “BusinessAnalytics” in the TFS server directory we have provided. We will use this location to save all our test scripts. Just select the location from the list and click on OK button. It will start uploading all file to the TFS server. This will take few minutes depending on the size of your test project.
How to upload changes made to the existing script?
Whenever there is a change in the application or business flow we need to update automation script. It is not feasible to upload the whole set of test cases, each time there are updates or when new tests are added. So, in this scenario we “Check-in” the scripts that have undergone changes. Test Studio records the changes made to the project and shows you the list of only those tests that have been modified or added. You can select the tests from the list and upload them.
How to check-in scripts in TFS?
Once, the scripts have been updated or new scripts have been added to an existing project you can check-in into the TFS. Right click on the project that you want to Check-in.
Select “Check In to Source Control” from the right click menu. Check-in comment Pop-up will open.
The pop-up will contain a list of all the Project(s) and Tests that have been modified or added. Each test will have a checkbox on the right. You can select the checkbox to select the tests that you want to check-in. Once you have selected all the tests to provide a check-in comment and click on the OK button. All the changes will be updated in the TFS.