January 2010 - Posts
How To Add File Upload To Team System Web Test With Relative Path
In the past I’ve write on How To Add File Upload To Team System Web Test, I got a question - Is there a way give a relative path of the document ?

Open Test Settings window - (See Below Image)
Enable deployment and add the files needed to file upload.
Now when running the test Team System will copy the files into the TestResult folder.
Than you can use this path.
Hope this helps.
PHP On Windows - Summary
Last week I attended in Guy Burstein lecture about PHP On Windows, you may ask what the relation between Me (Team System) and PHP?
In the past I was a PHP developer so a small part of me was curious to hear what new for PHP developers under Windows.
I came to this lecture with just one question –
Why?
As you know PHP on windows is not new, using ISAPI you can install PHP on IIS but still the question remains - Way?
- Even when using ISAPI PHP will not work on windows like he works on Apache (A lot performance problems).
- Money… Windows cost money…..
- Visual Studio is not so PHP friendly.
In spite of all this, Guy Burstein always has good answers and off course good performance, so here is 4 Big Reasons Why, I’ve learned from Guy’s lecture.
Reason 1: FastCGI = Very Fast
The IIS FastCGI component enables popular application frameworks like PHP be hosted on the IIS web server in a high-performance and reliable way.
FastCGI helps these application frameworks to achieve improved performance on Windows over CGI, while allowing stable operation in production environments
Getting started with IIS and PHP
Community PHP for Windows at PHP.net
The Open Source Community at Microsoft
The Microsoft Web Platform Installer 2.0 (Web PI) is a free tool that makes getting the latest components of the Microsoft Web Platform, including Internet Information Services (IIS), SQL Server Express, .NET Framework and Visual Web Developer easy. The Web PI also makes it easy to install and run the most popular free web applications for blogging, content management and more with the built-in Windows Web Application Gallery.
Installing Web Apps or updating the Microsoft Web Platform, Web PI’s improved validation support ensures everything just works.
Using Web Platform Installer you can install PHP application on Windows without any need to do manual configuration just selecting the desire PHP application you want to install and Web Platform Installer will do the rest.
I choose to install Joomla on Windows and then I got all the Dependencies required for installing Joomla on my system.

All you need to do is to Accept Web Platform Installer to install those components for you.

But this is not all – also the configurations are made during the setup, not need to modify and configuration files.
Below you can see MySql and Site configuration:
And after couple of minutes you are done!
Reason 3: Expression Web 3
Open and edit PHP pages directly in Expression Web 3 and apply the full range of standards-based design tools to PHP. Open and edit PHP pages directly in Expression Web 2 and apply the full range of standards-based design tools to PHP including code-coloring, snippets and IntelliSense™. It also ships with a PHP development server that lets you test your PHP pages without any other external web server dependencies
PHP IntelliSense -
Visual Diagnostics
Debug your pages in multiple browsers on the same machine that you use for development with SuperPreview. And Snapshot Preview provides a high-fidelity browser preview that updates live as you edit your code, saving you the time and effort of loading the page in a browser for each code change. The CSS properties palette visually displays the CSS cascade, enabling you to quickly see all of the styles that the current selection in your web page uses, the order of precedence of those styles, and all of the properties and values of those styles.
Another cool feature is Overlay Layout, shows both previews together so you can see the difference between those browsers.
Below is the CSS size you can take a fix in your code.
Reason 4 – Visibility, support and software for professional Web Developers and Designers - at no upfront cost!!!
Does your company have 10 or fewer employees?
Join WebSiteSpark program with A one-time $100 Program Offering Fee is due upon exit or at the end of the 3 year term.
Program Benefits
WebSiteSpark provides access to a technology offering for development and production hosting of websites. Once enrolled, you can download the following software from Microsoft:
- For design, development, testing and demonstration of new websites – for a total of up to three users per Web design and development company:
- Visual Studio Professional
- Expression Studio 3 (1 user) and Expression Web 3 (up to 2 users)
- Windows Web Server 2008 R2
- SQL Server 2008 Web Edition
- For production use – that is, to deploy and host new websites developed using Program software – using a total of up to four processors per Web design and development company, of the following (physical or virtual) dedicated servers:
- Windows Web Server 2008 R2
- SQL Server 2008 Web Edition
In addition to software, Microsoft
WebsiteSpark offers Web development and design companies the opportunity to:
- Get Business Opportunities: Get opportunities to expand your customer base and drive new business through showcasing your capabilities and connecting with partners, by featuring your talents in Microsoft marketing and business networking vehicles.
- Get Support and Training - benefits include:
- 2 professional support incidents
- Free online training Managed newsgroups on MSDN (a community of over six million developers) and other Microsoft online properties
- Access to broad community support through connections with Network Partners, Hosting Partners and peers with complementary services and technologies
For more information please visit Guy Burstein's Blog.
Thanks
VSTS 2010 Beta 2 – Coded UI Test – Tip 1 – Delete Recorded Actions
This is the first of post of many about CodedUI Test Tips, so what is CodedUI Test?
CodedUI Test – Is a new feature in Visual Studio Team System 2010 that allows you to create functional testing for your application very easily.
I’ll talk more about how the CodedUI works but for now the important detail is: IT’S NOT A SCRIPT Language, CodedUI works with .NET language that will allow you a lot more control and options when recording functional testing on your application.
Please take a look at Channel 9 – Video on How to create, edit and playback CodedUI Tests in Visual Studio 2010 Beta2.
TIP - During test recording there is a possibility some unwanted actions will be recorded, you don’t need to start all over again!
Just pause the recording and click “Show Record Steps” (Alt + s), now you can see all the actions from the last recording, select the unwanted actions and press delete.
Take Notice – Delete actions may ruined the recording and playback(Action that essential to the playback), make sure you test it after you delete to make sure everything works.

Apple Released Boot Camp Update For Windows 7
I don’t have IMac right now but maybe you do.
Either Apple isn't operating on the Gregorian calender, or these updates are just straight-up late. Either way, we're pretty stoked to see the suits in Cupertino finally wise up and allow Microsoft's best OS ever to work on its machines, as it has today issued new Boot Camp software (v3.1) for both 32-bit and 64-bit users of Windows 7. The updates add native support for Win7 Home Premium, Professional and Ultimate, and in case that wasn't enough, they also fix "issues" with the Apple trackpad and add support for Apple's wireless keyboard and Magic Mouse.
Full Article

VSTS 2010 Beta 2 – Diagnostic Data Adapters – Custom Adapter – Part 2
In my previous post Diagnostic Data Adapters – Create Custom Adapter – Part 1 I’ve showed how to create a Custom Data Adapter, this post will be on how to add a Configuration File to your Custom Data Adapter.
Download Demo Project
Step 1 – Add Configuration File
In your Data Adapter project add a new xml file and change the name to <name of your data diagnostic adapter>.dll.config
Copy below format into the xml config file:
<?xml version="1.0" encoding="utf-8"?>
<Config>
<DataCollector typeUri="datacollector://ShaiRaiten/LogsCollector/1.0" enabledOnCollectionOnlyAgents="true">
<DefaultConfiguration>
<Folder FullPath="C:\Logs\Day"/>
<Folder FullPath="C:\Logs\Night"/>
</DefaultConfiguration>
</DataCollector>
</Config>
Make sure the DataCollector typeUri attribute is the same as [DataCollectorTypeUri("datacollector://ShaiRaiten/LogsCollector/1.0")] from the Data Adapter class.
Step 2 – Initialize Configuration Element
In the Initialize method make sure to Initialize the Configuration XmlElement.
private XmlElement config;
public void Initialize(System.Xml.XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, AgentContext agentContext)
{
this.config = configurationElement;
Events.TestCaseEnd += new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
Step 3 – Use Configuration Element
void Events_TestCaseEnd(object sender, TestCaseEndEventArgs e)
{
try
{
List<string> folders = new List<string>();
XmlNode currentNode = config.FirstChild;
while (currentNode != null)
{
if ((currentNode.Name == "Folder") && (currentNode.Attributes["FullPath"] != null))
folders.Add(currentNode.Attributes["FullPath"].Value);
currentNode = currentNode.NextSibling;
}
foreach (string folder in folders)
{
string[] files = Directory.GetFiles(folder);
foreach(string file in files)
dataSink.SendFileAsync(e.Context, file, false);
}
}
catch (Exception ex)
{ throw ex; }
}
Step 4 – Install Configuration File
End you’re almost done, Build the solution, and then copy the built assembly and the Configuration file to -
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\DataCollectors
Now, Run the test and see the results below:

Full Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.Execution;
using System.Xml;
using System.IO;
using System.Diagnostics;
namespace LogsCollector
{
[DataCollectorTypeUri("datacollector://ShaiRaiten/LogsCollector/1.0")]
[DataCollectorFriendlyName("Local Logs Collector")]
public class LogsCollector : IDataCollector
{
private DataCollectionEvents Events;
private DataCollectionSink dataSink;
private XmlElement config;
public void Initialize(System.Xml.XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, AgentContext agentContext)
{
this.Events = events;
this.dataSink = dataSink;
this.config = configurationElement;
Events.TestCaseEnd += new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
void Events_TestCaseEnd(object sender, TestCaseEndEventArgs e)
{
try
{
List<string> folders = new List<string>();
XmlNode currentNode = config.FirstChild;
while (currentNode != null)
{
if ((currentNode.Name == "Folder") && (currentNode.Attributes["FullPath"] != null))
folders.Add(currentNode.Attributes["FullPath"].Value);
currentNode = currentNode.NextSibling;
}
foreach (string folder in folders)
{
string[] files = Directory.GetFiles(folder);
foreach (string file in files)
dataSink.SendFileAsync(e.Context, file, false);
}
}
catch (Exception ex)
{ throw ex; }
}
public void Dispose()
{
//Unregister events
Events.TestCaseEnd -= new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
}
}
Download Demo Project
Enjoy.
VSTS 2010 Beta 2 – CodedUI Test – Access Denied Error
While recording CodedUI Test I had very irritating problem:
Each time I record a Test (even opening the application) I’ve always got the following error message:
Solution:
You cannot run Visual Studio and Test Application with different users or same users but different admin privilege.
In my scenario Visual Studio was running with my User and the Test Application with another user.;
Enjoy
VSTS 2010 Beta 2 – Diagnostic Data Adapters – Custom Adapter – Part 1
In my previous post I’ve talked about What is Diagnostic Data Adapters – No More No Repro!, this post will be about how to
create your own Diagnostic Data Collector.
Download Demo Project
In this post I’ll show you how to create a custom Log data collector that can be very helpful for many applications using local logs.
Below is an example of advanced custom data adapter I built for collecting performance data during a test. – I’ll get to this later…
Step 1 – Getting Started
Create a Class library project and add two references:
- Microsoft.VisualStudio.QualityTools.Common
- 2. Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll
You can find those assemblies C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\
(If you are not using 64bit operation system - C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\).
Step 2 – Create Data Collector Class
1. Add new class to your project with the Data Collector name, make sure the class defined as Public and add both using to the class:
using Microsoft.VisualStudio.TestTools.Execution;
using Microsoft.VisualStudio.TestTools.Common;
2. Add the Data Collector attributes
[DataCollectorTypeUri("datacollector://Manufacturer/DataCollectorName/Version")]
[DataCollectorFriendlyName("Data Collector Name")]
3. Add IDataCollector interface and implement it.
This is what you should see:
public void Initialize(XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, AgentContext agentContext)
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
Step 3 – Implement Custom Data Adapter
Using the DataCollectionEvents add the desire events for the Custom Data Adapter.
CustomNotification Raised when a custom notification occurs.
DataRequest Raised to request intermediate data.
SessionEnd Raised when a test session ends.
SessionPause Raised when a test session pauses.
SessionResume Raised when a test session resumes.
SessionStart Raised when a test session starts.
TestCaseEnd Raised when a test case ends.
TestCasePause Raised when a test case pauses.
TestCaseReset Raised when a test case resets.
TestCaseResume Raised when a test case resumes.
TestCaseStart Raised when a test case starts.
TestStepEnd Raised when a test step ends.
TestStepStart Raised when a test step starts.
And define DataCollectionSink for storing files as attachments.
For Example:
private DataCollectionEvents Events;
private DataCollectionSink dataSink;
private const string LogPath = @"C:\Logs";
public void Initialize(System.Xml.XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, AgentContext agentContext)
{
this.Events = events;
//DataCollectionSink - Diagnostic data adapters use a DataCollectionSink to store files and
//XML data for later attachment to bugs and test reports.
this.dataSink = dataSink;
Events.TestCaseEnd += new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
Now write the code to collect the logs from the specified folder.
void Events_TestCaseEnd(object sender, TestCaseEndEventArgs e)
{
try
{
if (Directory.Exists(LogPath))
{
string[] files = Directory.GetFiles(LogPath);
foreach (string f in files)
{
dataSink.SendFileAsync(e.Context, f, false);
}
}
}
catch (Exception ex)
{ throw ex; }
}
Step 4 – Install Custom Data Adapter
End you’re almost done, Build the solution, and then copy the built assembly to -
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\DataCollectors
Now create a new test (VS2010 – Coded UI Test) and define the new Data Adapter(Team System 2010 Beta 2 – Diagnostic Data Adapters – No More No Repro!).
I’ve built a simple WPF application that creates log file in C:\Logs.
Below image show a normal run of CodedUITest without selecting the data adapter.
Below image show a CodedUITest run with Logs Data Adapter selected.
Local Logs Folder

Full Code Sample:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.Execution;
using System.Xml;
using System.IO;
namespace LogsCollector
{
[DataCollectorTypeUri("datacollector://ShaiRaiten/Logs/1.0")]
[DataCollectorFriendlyName("Local Logs Collector")]
public class LogsCollector : IDataCollector
{
private DataCollectionEvents Events;
private DataCollectionSink dataSink;
private const string LogPath = @"C:\Logs";
public void Initialize(System.Xml.XmlElement configurationElement, DataCollectionEvents events, DataCollectionSink dataSink, DataCollectionLogger logger, AgentContext agentContext)
{
this.Events = events;
//DataCollectionSink - Diagnostic data adapters use a DataCollectionSink to store files and
//XML data for later attachment to bugs and test reports.
this.dataSink = dataSink;
Events.TestCaseEnd += new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
void Events_TestCaseEnd(object sender, TestCaseEndEventArgs e)
{
try
{
if (Directory.Exists(LogPath))
{
string[] files = Directory.GetFiles(LogPath);
foreach (string f in files)
{
dataSink.SendFileAsync(e.Context, f, false);
}
}
}
catch (Exception ex)
{ throw ex; }
}
public void Dispose()
{
//Unregister events
Events.TestCaseEnd -= new EventHandler<TestCaseEndEventArgs>(Events_TestCaseEnd);
}
}
}
Download Demo Project
Enjoy
CopySourceAsHtml Support For Visual Studio Team System 2010 Beta 2
I’ve used existing project from CodePlex - http://copysourceashtml.codeplex.com/ and add Visual Studio 2010 support.
You can download the installer directly from Here - http://copysourceashtml.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=100271
9 [TestClass]
10 public class UnitTest1
11 {
12 [TestMethod]
13 public void TestMethod1()
14 {
15 //Let's Test CopySourceAsHtml in Visual Studio 2010 - Shai Raiten
16 }
17 }
You can download the installer directly from Here - http://copysourceashtml.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=100271
or directly from the patches section
Enjoy
Team System 2010 Beta 2 – Diagnostic Data Adapters – No More No Repro! – Part 1
What is Data Adapter?
Diagnostic Data Adapters will allow you specify various types of data to collect or how to affect the test machine when you run manual tests, automated tests, or both.
For example, a diagnostic data adapter might create an action recording, an action log, a video recording, or collect system information.
Additionally, diagnostic data adapters can be used to simulate potential bottlenecks on the test machine or reduce the available system memory.
For example, you can emulate a slow network to impose a bottleneck on the system.
How To Define Data Adapter?
You can define data adapters in two places – Microsoft Test & Lab Manager (manual testing) and Visual Studio 2010 (automated testing).
Microsoft Test and Lab Manager
Open MTLM and create a new Test Plan (Team System 2010 - Create a Test Plan [HE] – Screencast)
Visual Studio 2010 Beta 2
After you create a Test Project you will notice Local.testsettings file was created under “Solution Items” folder.
The bellow pictures shows two ways on how to open the Test Settings window.
Now Run and Open BUGS with a lot of data to help you and the developer solving it faster.
