Wednesday, December 20, 2017

One Plus 3T and 5

Tuesday, September 20, 2016

Visual Studio ALM Virtual Machines HOLs links

Wednesday, July 6, 2016

TFS 2013 Team Build : Part 2 - How to change the default build number format of a build definition.

How to change the default build number format of a build definition to give meaningful names to the completed builds.
Hi All,
In this post we will see how we can change the Build Number format to give meaningful names to the completed builds. By default the build number format of the build is: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)

SampleCI_20160706.1
Example: If my build definition name is SampleCI then the build number will be:
  •         SampleCI_20160706.1
  •         SampleCI_20160706.2
  •         SampleCI_20160706.3

To change this to some other format, we have to go to any of the build definition we have created or new. In the Build Definition go to BuildNumberFormat process parameter in “Process Tab”.
Our goal is to change the build number format as shown below, we want to capture the team project name also in the build number. $(TeamProject)_$(BuildDefinitionName)_$(Date:yyMMdd)$(Rev:.r) let’s see how to do this.


Step 1. Create a new Build Definition or open existing build definition, then click on Process tab.

Step 2. Under Process tab, look for Build Number Format process parameter and click on the ellipses button as shown in below screenshot.


Step 3. In the BuildNumber Format Editor window, you can see default build number format string and its preview. To see and add the other tokens click on Macros >> button.


Step 4. On clicking Macros >> button, you can see all available list of tokens and its values as shown in below screenshot



Step 5. Since we wants to add the $(TeamProject) token before $(BuildDefinitionName), place the cursor at the starting point i.e. before $(BuildDefinitionName), tag as shown below. Then select the $(TeamProject) token and click on Insert button.



Step 6. On clicking Insert button, we will see that the token is been added to the format string and we can modify the string by adding a underscore symbol (_) to differentiate between Team project name and build definition name as shown below. Click Ok button


Step 7. That’s all, we are done with setting the build number format to
$(TeamProject)_$(BuildDefinitionName)_$(Date:yyMMdd)$(Rev:.r)
We can see the format in the build process parameter value as below.



Step 8. Save the changes to the build definition and queue the build.


In the My Builds dropdown list of Team Explorer builds page we can see that build number also includes Team Project name , here in my case Team project name is FabrikamFiber and build definition name is DemoApp


Below screenshot shows the Team Project Name in build summary report




Hope you enjoyed this blog. Let me know for any queries.


Monday, June 27, 2016

TFS Work Item Customization using TFS Power Tool: Part 5

How to restrict the user or group from creating or updating a specific work item type.

 

Hi All,

In this post we will see how to stop a user or group from creating or updating a particular work item type in TFS team project.

In TFS team project we can either give read/write permission to all work item type or none of them, but it is not possible to restrict the user or group from creating or editing a specific work item type like bug or task.

In this post I’m going to provide a work around to achieve the requirement- where a user or group should be able to create or update all work item types except Bug, let us see how to do this.

    1.      Open bug work item template using process tab.

    Open Visual Studio, and Click on TOOLS -> Process Editor-> Work Item Types-> Open WIT from server, to open the template online.

       

      https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6aY-PWA-6JDK8_dsu3Viqlf38S9hPbzKwwxtS1yczhd0mVud780Xf_yZPiqAHP-YZdbOUSwRxbYK1dPm4c7lCSzE8AfCwKUB6gVVD_TWenuifbDAnvXCz-khxenP3jbXoIXCZnD3mGXoB/s1600/OpenTaskOnline.png

      2.      Now connect to the TFS and then to the Team Project under the Team Project Collection. Select work item type Bug.

       

      3.      Look for field Changed by and double click on it to edit.

       

      4.      When Field Definition window opens, click on Rules tab to add a new rule READONLY by clicking New button.

      5.      In the Select a rule type window select rule named READONLY, then click OK.

      6.      Now time to use this rule to achieve our requirement, identify the group to which this bug work item type should not be editable. Here in my example I want make bug work item type non editable for members of the Team Project Default group Contributors.

      Pass the value [project]\Contributors in the field For, find below screenshot for your reference.

      Then click OK.

      7.      Now you will see the new rule added to the list. Click OK. Then Save changes to server by clicking Save button of Visual Studio or using key board shortcut , Ctrl+s

       

      8.      Now connect to Team Project then open Team Project Administer Sever Page by clicking on  Administer Server gear button.

       

      9.      In Team Project Administer Sever Page open Security Tab. Under Security Tab look for group Contributors and add a windows user by clicking Add button under Members tab.

       

       

      Search for the member. Then click on Save changes button.

       

      Now a new member (Brian Keller) is added to the group Contributors.

      10.   Now login as one contributor member and connect to Team Project, here it is Awesome Team Project.

      11.   Click on Create new, dropdown list and select Bug work item type.

      12.   Enter the details and then click on Save button.

      13.   On Clicking save this user will be prompted with message as shown in below screenshot. By this way can restrict user from creating and updating Bug work item type.

       

      Hope you enjoyed this blog.

      Happy blogging J

       

Tuesday, April 12, 2016

Different ways to create Team Project for VSTS default collection

Visual Studio Online(VSO) is now  Visual Studio Team Services (VSTS)


Hi All, 
In my previous post on VSO (i.e VSTS) I have explained the steps to create free VSTS account,in this post we will explore different options for creating new team project in VSTS account. As we all know in VSTS we can have only one collection , i.e. DefaultCollection under which we can create multiple team projects. Here are the different options to create Team Project.

Connect to your VSTS account (Ex: https://explorevsonline.visualstudio.com/)

Method 1:

Below screen will appear if you have opted out creating team project during VSTS account creation or there is no Team Project created on your VSTS account. On this page you can input details like Team Project name, choose process template,select the version control type(Git or TFVC) then click on Create project button.


Method 2:

Another way for creating team project is by clicking on  Manage Account i.e the gear button at the top-right corner as shown in the below screenshot,



 when you click on the gear button as shown above you will be redirected to the VSTS admin page. In this admin page you can find the control panel tab and you can also find link for creating new Team project. Click on "Create a new team project" link present at the right side under Control panel, which will pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1


Method 3:

In case you have already created a Team Project and want to create one more, use below option to quickly create a team project.
In your VSTS account Overview tab you can find "New" link under "Recent projects & teams" section as highlighted in below image, click on the "New" link. You will get pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1




Method 4:

If you have already connected to the team project and using any of the tabs like, Home /Code / Work / Test / Release / Build, you can quickly create new team project by clicking on the current team project link, which displays the drop down list with option for "New team project" as highlighted below. Click on "New team project" option. You will get pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1


hope this article finds you  interesting, happy blogging :)

Sunday, April 3, 2016

Hand Coding Coded UI Test using Visual Studio



Hi All,
In this post we will learn how to create the Coded UI Automation test script by hand coding the entire scenario along with UI objects. Explanation about how the Visual Studio Coded UI tool will identify the controls and perform UI actions is out of the scope of this blog.
Please find sample source code for practice on below steps here.
In this blog we will take a simple scenario, we will hand code the automation script for the default Calculator application available in windows system. From launching the Calculator application, declaring and getting UI or Search Properties and to perform all the UI action we will hand code C# scripts using the objects available in the application. The scenario is as below:
1.      Launch Calculator application
2.      Click button 8
3.      Click button +
4.      Click button 7
5.      Click button =

6.      And validate the result which be on the result text box.

So let’s open Visual Studio tool (Ultimate/Premium) any version from 2010 to 2015. Select the Visual C# as the scripting language and under Visual C# template select the Test option and choose the Coded UI Test Project as below. Give a name for the test project, click on Ok button. Your test project is ready.

You will get a pop-up window to select either “Record Actions” or “Use an existing Action Recording”. Since we want to hand-code the test, we will cancel this window and follow the below steps for hand scripting the Coded UI test.


  1.      Now right click on the test project you created and create a class file called “Launch.cs” for getting the main calculator window details

2.      In the class use below namespace.
        using Microsoft.VisualStudio.TestTools.UITesting;

3.      Declare a static variable under class
        public static UITestControl calciwindow;

4.      Then create a static method called “Control” inside the Launch class which will return UITestControl object as below

This gets the main window/control of calculator App, which will be used as parent control for all the button and text and other UI controls inside the calculator App.
                public static UITestControl Control()
        {
            calciwindow = new UITestControl();
            calciwindow.TechnologyName = "MSAA";
            calciwindow.SearchProperties[UITestControl.PropertyNames.Name] = "Calculator";
            calciwindow.SearchProperties[UITestControl.PropertyNames.ClassName] = "CalcFrame";
            return calciwindow;
        }
Your class should look like below image.



5.      So we have got the code to launch the Calculator Application. Now let’s create a Coded UI test class which will call the main calculator window and perform the UI actions on the application.
6.      Now create another class “CalciFun” or any other name, which will be a Coded UI Test class
Use below Namespaces for the class
               using Microsoft.VisualStudio.TestTools.UITesting;
               using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
               using Microsoft.VisualStudio.TestTools.UnitTesting;

7.      Mention [CodedUITest] attribute on top of the Class

8.      Declare a static variable under the class to get the main Calculator window details which is available in Launch class
               static UITestControl control = Launch.Control();

9.      Create a New method CallFun as below inside the class. For now let’s keep it empty. Mention [TestMethod] attribute on top of new method.
[TestMethod]
public void CallFun()
        {
               }


10.   Now create static methods inside the class for each of the controls after the CallFun” method.
11.   Use the static variable declared above in step 8 as “parent control” for all the UITestControl objects you are going to create.
12.   We are going to declare few button and text controls. Like below we are getting the UI/Serach properties for button controls in Calculator application namely button 7, 6, Add and Equals, which will be later used by the tool to execute the test and perform UI actions. In the same fashion declare text control and UI properties to identify the Result box/text control available in Calculator Application.

For Button Controls

public static UITestControl btnmethod8()
        {
            UITestControl btn8 = new WinButton(control);
            btn8.SearchProperties[UITestControl.PropertyNames.Name] = "8";
            return btn8;
        }

public static UITestControl btnmethod7()
        {
            UITestControl btn7 = new WinButton(control);
            btn7.SearchProperties[UITestControl.PropertyNames.Name] = "7";
            return btn7;
        }

public static UITestControl btnmethodAdd()
        {
            UITestControl btnAdd = new WinButton(control);
            btnAdd.SearchProperties[UITestControl.PropertyNames.Name] = "Add";
            return btnAdd;
        }

public static UITestControl btnmethodEqual()
        {
            UITestControl btnEqual = new WinButton(control);
            btnEqual.SearchProperties[UITestControl.PropertyNames.Name] = "Equals";
            return btnEqual;
        }
For text Box Controls
public static UITestControl txtmethodResult()
        {
            UITestControl txtResult = new WinText(control);
            txtResult.SearchProperties[UITestControl.PropertyNames.Name] = "Result";
            return txtResult;
        }
           

13.   Now go back to “CallFun” method created in step 9, and start performing the UI actions using the controls defined, and validate the results. The method should look like below:


Now run the test. With the above code the Coded UI test engine will Launch the App and perform the UI test.
The test is going to fail because the expected value is 10 , but actually application returned value is 15.

To pass the test you can change the expected values 10 to 15 in the Assert function.


Hope this helps, thanks for reading this blog. :)