Showing posts with label lab. Show all posts
Showing posts with label lab. Show all posts

Wednesday, 30 September 2015

Disable Lock Screen on Windows 8.1 to Prevent - Automation engine is unable to playback the test because it is not able to interact with the desktop.

You might run into below error with automated testing with lab environments.
*******************************************************************************************************Error calling Initialization method for test class xxxxxxxx: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: Automation engine is unable to playback the test because it is not able to interact with the desktop.  This could happen if the computer running the test is locked or it’s remote session window is minimized.
*******************************************************************************************************

image
This could be because you have RDP to the test agent machine and you have logged out, minimized the RDP session. This can be prevented by repairing the lab environment and let it restart the test agent machine. Then as long as you do not RDP to test agent it should run automated tests without any issue.image
But if your test agent machine is Windows 8 or Windows 8.1 you might still run into the same error, even though you are 100% certain, that after repairing the lab environment, you have not RDP to the test agent machine.
This happens due to the lock screen functionality of Windows 8 and 8.1. to fix this issue disable the lock screen. This can be done in Group Policy Editor. Run gpedit.msc and set the “Do not display the lock screen” to “Enabled” sate.image
This will set the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization with DWord “NoLockScreen” to value 1.image
More information on setting lock screen to disable, can be found here.

Disable the screen saver for Test Agent user.image
Set “Turn off the display” to never.image

In registry set the following DWord “DisableLockWorkstation”. Instructions here.image

More instructions in the answer here. Set and verify all of them.

Repair the lab environment again to make sure the restart of the test agent and, as long as no RDP sessions to the test agent machine, automated test will not run into “Automation engine is unable to playback the test because it is not able to interact with the desktop”.

image

Thursday, 23 January 2014

Resolving - "Verify that the machines are accessible using the user name and password provided" in TFS Lab Setup in Workgroup Environment

I have encountered yet another issue while configuring TFS LAB standard environment and though it would help some one if I explain how did I resolve it.

The error happens in verify step of lab configuration and it is giving "Verify that the machines are accessible using the user name and password provided". Lucky for me this time I do not have to explain much all is well explained here thanks to Subramanyam [MSFT].

The next related error "The agent can connect to the controller but the controller cannot connect to the agent" is explained in my blog post.

The fixes are valid for joining Standard machines to TFS LAB environment, from not trusted domains or work-group.

Thursday, 31 October 2013

TFS - Lab Build - Deployment Script - Copy Build Output Zip to Lab Env. Machine and Extract

As a continuation to my last post "TFS - Lab Build - Create Zip File with Build Output in the Drop Folder", today I am going to explain how to use a deployment script with lab build (Build-Deply-Test workflow), to copy the build out put zip file, to Lab Environment Machine and extract.

1. First I am going to create a batch file and a PS script. My PS script will do all the work. Batch file (.bat) will be used to initiate the powershell script from Lab Workflow. To get this to work I need to make sure my batch file and the PS script is copied to build output folder, since it is the place that I can execute a deployment script from Lab Work Flow.

I have added my .bat file and the PS script file under a VS project that is under a solution I am building, and set the Copy to Output as always.


2. This will copy my .bat and PS script to Build Drop folder.


3. This is what I have in my .bat file. It is simply executing the PS script making sure execution policy is not blocking anything. Build location here is passed as an argument from the Lab Workflow.


4. In my Lab Build in the deployment steps I specify the .bat file to run as below. For more information and how to use xcopy to copy build out put have a look at "Creating Deployment Scripts for Build-Deploy-Test Workflows". I used a poweshell script since I am going to do lot more than just copying files, like adding dlls to GAC, etc which I will explain in a next post.

$BuildLocation is giving the build output location of the build that is queued/used by  Lab workflow.



5. In my poweshell script I am copying zip to my lab environment machine. The path C:\ ..refers to the path in the lab environment machine, since  the deployment script get executed in the context of given lab environment machine as specified in the above screenshot.

After copying this script will extract contents to the copied location and remove the zip file from the Build Drop folder. Build Location is passed to the poweshell script from the above .bat file as a parameter.


6. I queue a build and I can see my zip file copying actions get executed in the Build Log as below.


7. In my lab environment machine I see the extracted files .


This is cool .. don't you think..


TFS - Lab Build - Create Zip File with Build Output in the Drop Folder

Sometimes it takes long time to copy files from drop folder to the lab environment when you have your lab environment in different locations( distributed environments), and you have several hundred files in your drop folder (example - published website with lot of files).

I will explain how to use a Build Activity to zip, by customizing LabDefaultTemplate.11.xaml.

How to add a custom code activity to a build template is clearly explained in this article http://www.ewaldhofman.nl/post/2010/04/29/Customize-Team-Build-2010-e28093-Part-4-Create-your-own-activity.aspx

Go through the above article if you want to know the basics.

So lets look at how to add a build activity to zip the build output.

1. First you need to have a code activity similar to below


2. Once compiled and add reference to your build template project you can view the New Activity --> Zip in the Toolbox when you open the build template.


3. Drag and drop the  Zip activity to LabDefaultTemplate.11.xaml after the "Compute build location needed" activity to make sure BuildLocation variable is filled with the correct build location (This variable will contain the Build Folder path of the Build queued or used by the Build task of the Lab Workflow).



4. Set the properties as below in the Zip build activity. DirectoryLocation is set to Build Location and Zip file path will be Build Location path with ".zip" extension. This will make sure zip file is created at the drop location of the build used by the lab workflow.


5. Create a build definition using the lab template and set the lab workflow build step to use the release build definition of yours (Output of this build will be used to create the zip file).


6. Queue a build with the lab build and you will see lab(build-deploy-test) build, queues  the release build, once complete use the build location and create the build output as a zip file.


7. In the drop location of the release build you will have the build out put files and the zip file of the output.


In my next post, I will explain "How to use a deployment task of the Lab Workflow to copy the output zip file and extract it in the Lab Environment Machine".

Popular Posts