Thursday, 12 February 2015

Installation and Configuration of Test Controller and Test Agent without TFS


Test controllers and Test agents have the following software requirement:
Operating System
To install a test controller or a test agent, the computer must run one of the following operating systems:
  • Windows 8, Windows 8.1
  • Windows 7 Service Pack 1
  • Windows Server 2012, Windows Server 2012 R2
  • Windows Server 2008 Release 2, Service Pack 1
  1. Windows 8, Windows 8.1
  2. Windows 7 Service Pack 1
  3. Windows XP Service Pack 3
  4. Windows Server 2012, Windows Server 2012 R2
  5. Windows Server 2008 Release 2, Service Pack 1
  6. Windows Server 2003 Service Pack 1
.NET Framework
      To install a test controller or test agent, the computer must run the .NET Framework 4.5.


      Change the UAC settings in both the systems to "Never Notify"

New Local User as Administrator
      On each computer where you will install a test controller or a test agent, create a local user account that is a member of the Administrators group. Login with the local user and use the same account and password on each machine.
  1. Note:- If you are not Creating the Local User and using the same default administrator you might face issue while configuring
  2. Use this user account for your test controllers when you install and configure them.
     Team is the Local user which has been added into the machines where Test Controller and Test Agent are installed. On filling the above details by clicking on "Apply Settings" you see a pop up with validations happening. There will be an Configuration warning as we are not using the lab manager. It can be ignored
  3. Right click on the computer and Select Manage. In the Computer Management window, navigate to System Tools -> Local Users and Groups -> Groups. Add this account(i.e. Team) to the TeamTestAgentService group on the test controller machine.
  4. Install and configure your test agents using this same account(i.e Here Team).

    Configure the Test Agent with the following details. To register the Test Controller with this Test Agent give the IP Address and Click Apply Settings.
  5. Once the Setting are applied you can see a "Test Agent Status" Window appearing as below

    If the Test Agent Status is "Online" Then you are ready with the Set up for remote executions

Monday, 9 February 2015

Record one application only in CodedUI Test

Generally, we test a single application using Coded UI Test. By default, Coded UI Test though will record actions on all applications.  Thus we may get unwanted actions on other application in our recording.

We can prevent this by adding the following configuration in CodedUITestBuilder.exe.config file
<add key="IncludeProcess" value="%SystemRoot%\system32\calc.exe"/>

Replace calc.exe with the full path to your application. With this configuration only actions on calc.exe (or the application that you added) will be recorded.

When using IncludeProcess, actions on the Windows desktop are not recorded. If you want to include actions on the Windows desktop, add the following configuration.
    <add key="RecordOnDesktopProcess" value="true"/>

Alternately, we can also selectively exclude applications from recording using the following configuration.
<add key="ExcludeProcess" value="%SystemRoot%\system32\calc.exe"/>
Replace calc.exe with the full path to the application you want to exclude from recording.

NOTE: These settings are applicable for Recording only. We can still drag the cross hair onto any application, get its properties and add assertions on them.

If you see that no actions are being recorded on a particular application, first check this config file to ensure that the application has been added in the ExcludeProcess section. Also verify the IncludeProcess  configuration. If a particular process has been added in IncludeProcess, then actions on your applications will not be recorded.

It is possible (though not recommended) to add process ids to IncludeProcess & ExcludeProcess configurations.

Usage of Cordinate based actions in CodedUI

When you record actions & generate code in Coded UI Test, you get actions like
Mouse.Click(uISearchButton, new Point(18, 15));

Many confuse by the Point argument we pass to Mouse.Click and believe that we are doing a coordinate based action. The Point argument here is relative to the button itself. So test will not fail if the button moves around in the page.

More importantly, you can completely remove the Point argument. The code could be written as

This will still work. If no Point argument is specified, Visual Studio UI Test Framework determines a clickable point and performs the click on that point.

So why do we use coordinates?

There are specific scenarios where these coordinates really come in handy.

Consider a DropDownButton, which drops down when you click on the expander arrow. If you click on the button’s normal area, it is invoked. If you click on the expander, it shows the additional buttons and you can click on one of them. Since we record relative coordinates for the click action, we can playback the actions on the expander also. If we had not recorded coordinates and clicked on the first available clickable point in the button, this scenario would have failed.
e.g:- Look at the screenshot below.

Here I am clicking on the expander in Picture Button to bring up additional options. This scenario will only work if we record relative coordinates on the click action.