Visual Studio 2010

Removing other’s workspace in TFS: 

A common scenario while using a system used by some one else who earlier used the same TFS workspace.
You need to be either the owner of the workspace or have the Administer workspaces permission on the Team Foundation Server to perform this.
Open Visual studio Command prompt at

More…

Comparing Dates in C# , selenium RC 

Example to convert string to date time variable and also compare two date time variable.
string Firstdate = selenium.GetText(FirstDate_xp);
string Nextdate = selenium.GetText(Nextdate_xp);
DateTime date1 = Convert.ToDateTime(Firstdate);
DateTime date2 = Convert.ToDateTime(Nextdate);
int result = DateTime.Compare(date1, date2);
//Compare function returns
//0 if both dates are equal
//1 if date1 is recent than date2
//-1 if date2 is recent than date1

If you found this solution helpful or have something extra to add, feel free to share it here by commenting below.

By Rashmi on September 2, 2011 | Selenium RC, Visual Studio 2010 | 2 comments
Tags: ,

Selenium RC Coding using C Sharp #region 

When you are writing a piece of selenium test script you can use the #region a feature of the Visual Studio Code Editor. This will let you specify a block of code that you can expand or collapse. Here is an example that shows the use of #region in the test method Typeall
#region Typeall
public void Typeall(string[] path, string[] value)
{
int len = path.Length;
for (int i = 0; i <= (len - 1); i++)
{
if (selenium.IsElementPresent(path[i]))
{
selenium.Type(path[i], value[i]);
}
}
}
#endregion

By Pavandeep Puddupakkam on September 1, 2011 | Visual Studio 2010 | A comment?
Tags: , , ,

Selenium RC Test Framework using XML Data structure 

In this example I will explain you how to create a Selenium RC test framework and have the test data including the xpaths in a XML data file. The scripts mentioned under are as following:
1. ObjectRef.cs file that has the test data and the xpaths defined, the code to read the XML Data file
2. FunctionReference.cs that has the TestInitialize and TestCleanup. The Test Data and Xpaths are in Data.xml.
3. Two test methods Google_AU and Google_US scripts (Google Search) – Google_AUTest.cs and Google_USTest.cs
Add System.Xml.dll to the reference library.

More…

How to verify if there are even number of xpaths in Selenium RC 

There was a requirement to check if there are even number of a particular element on a web page. Here is the code to check if there are even number of element xpath on the page. The code is in Visual Studio C#.
try
{
Assert.IsTrue(Convert.ToInt32(selenium.GetXpathCount("//div[@id='elementid']")) % 2 == 0);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

Selenium 2 Webdriver example using Visual Studio Test Project 

This is an example of Selenium 2 Webdriver using Visual Studio Test Project; using Visual Studio Test Project you can run the Selenium 2 Webdriver scripts without using NUnit.
To download the latest version of Selenium 2 go to http://code.google.com/p/selenium/downloads/list. All the dll files that are in selenium-dotnet-2.0.0.zip as reference to the Test Project.

More…