Sunday, 22 January 2012
Google Automation-Automated Testing Search Engine
Friday, 16 December 2011
Dynamically Find controls Type used in web application using WaTin
Using this WaTin feature user would be able to get all the controls types dynamically used in web page.
Details:
Let me give an example to explain this with clear picture.
Suppose that developer has placed a table on webpage. This table would contents many controls like textbox, button, picture box, label, dropdown, list etc. etc. all this control would appear in table cells dynamically, it means we are not sure when and at what position of cells it will appear in table.
Now we have to read this control on fly and performed some basic operation.
So being an automation engineer, we have programmed our automation code in such a way to know about this control and where it has appeared then performed operation or read properties of that control.
Its bit tricky to handle this kind of situation.
To solve this kind of issues WaTin have provided one best feature to get the type of controls and then based on control we can call our custom method to either get the properties or performed common action.
Here I will only show to how to read controls types on FLY using WaTin.
Below is the Image of web page (to automate this scenario I have developed one basic web application)
try
{
IE ie = IE.AttachTo<IE>(Find.ByUrl("http://localhost:28348/Home.aspx"));
var tablecells = ie.Table("table").TableCells;
var type = new string[tablecells.Count];
int i = 0;
foreach (TableCell tableCell in tablecells)
{
try
{
string watinType = tableCell.Elements[0].GetType().FullName;
if (watinType != null) type[i] = watinType.Split('.')[2];
}
catch (Exception)
{
throw;
}
i++;
}
}
Catch (Exception)
{
throw;
}
Thanks,
Md. Jawed
Saturday, 5 March 2011
C# Code snippet to send an Email with attachment from Outlook, Yahoo, HotMail, AOL and Gmail
Introduction
Using this code snippet user would be able to send an email with attachment through Outlook, Yahoo, AOL, HOTMAIL and Gmail.
Background
Already loads of information are available on internet for the same purpose. But not all the code is placed at one place. So here is my small effort to accumulate all the code at one place and that is nothing better than CodeProject. Hopefully it will be helpful for the beginners or whoever in needs of it.
Using the code
Name Space:

Below is the Block diagram for the SMTP settings i have used to send out an email from various client providers.
Wherever needed I have explain the code in details. The codes are self explanatory, any way for the same I have included comments. So here is the code snippet to achieve your purpose.1. Using Outlook:
To send an email using outlook, we need to add a reference to the dynamic link library for Outlook which is called Microsoft.Office.Interop.Outlook.dll.
For the same follow the below steps
2. Click on add a reference
3. Click on .Net Tab
4. Go through the DLL and select Microsoft.Office.Interop.Outlook.dll correctly.
5. When you have selected the correct reference you select the “OK” button and this reference will be added to your project under references. 
6. Now we need to add a reference in our class to the Outlook reference we have added to the project in our previous example.
using Outlook = Microsoft.Office.Interop.Outlook;
And finally the code would look something like this:

2. Using HOTMAIL:
To send an email using HotMail, we need to add a reference to the dynamic link library for Hotmail/Gmail/AOL/Yahoo which is called System.Net.Mail.
For the same follow the below steps:
1. Go to solution explorer of your project
2. Select add a reference
3. Click on .Net Tab
4. Go through the DLL and select System.Net.Mail.
5. When you have selected the correct reference you select the “OK” button and this reference will be added to your project under references.
6. Now we need to add a reference in our class to the Hotmail/gmail/aol/yahoo reference we have added to the project.
using System.Net.Mail;
Note: The HOTMAIL SMTP Server requires an encrypted connection (SSL) on port 25.
And finally the code would look something like this:
3. Using Yahoo!
4. Using AOL:
5. Using Gmail:Note: The GMAIL SMTP Server requires an encrypted connection (SSL) on port 487.

Already I am using the above code snippet for my automation purpose and its working fine for me!!
Thank you!!
Feel Free to provide your comments and suggestion.
Md. Jawed.
Saturday, 26 February 2011
QC DATA PULLER using C#
i have pulished an Articles on Code project for generating report for test cases executed from QC. the report would be in HTML web page format with pie chart and tabullar format.
for more details you visit below link for that:
QC Data Puller on Code Project.
Please go through the link and provide your valuabe comments and suggestion!!
Thank you!!
~jawed
Tuesday, 15 February 2011
WatiN 2.0 Final Released: Ready to Download

Below is the Email from Jeroen van Menen.
All,
Last week I have release WatiN 2.0 Final (2.0.50.1179). You can download the zip file from Sourceforge:
http://sourceforge.net/projects/watin/files/WatiN%202.x/2.0%20Final/WatiN-2.0.50.1179.zip/download
or install it using NuGet (need to have the Package Manager console for Visual Studio 2010 installed, get it at nuget.org). Installing is as simple as:
PM> Install-Package WatiN
The release notes can be found on the new website http://watin.org/ (which is still in flux but getting there)
http://watin.org/documentation/release-2-0-50-11579/
Enjoy Testing with WatiN!
Jeroen
~JAWED
Thursday, 3 February 2011
Test Automation FX - UI Testing in Visual Studio
After searching I came across TAFX(Test Automation FX). This was a nice tool which will give you the freedom of language, recording and nice flexibility to customize the generated code after recording.

Let me put some point which I have noted down from web:
Test Automation FX (TAFX for short) enables developers and testers to record and manage user interface tests from inside Visual Studio with 100% .NET code.
You go through this official web site of TAFX:
http://www.testautomationfx.com/
Go through below link to get screen shot of Automation of Calculator using TAFX:
http://www.testautomationfx.com/index.php/screenshots
Shortly, I m planning to give a try to this tool. Will forward my finding and experience in next blog soon.
this is not an open source tool :(
Sunday, 26 December 2010
Force your Thread to start in Single-threaded apartment state
//by default this thread will start in MTA(Multi Apartment state)
string firstValue;
int secondValue;
bool thridValue;
//create an thread
Thread myAutomationThread;
// The delegate to call.
ThreadStart ts = new ThreadStart(delegate() { callMyFun(firstValue,secondValue,thirdValue); });
// The thread.
myAutomationThread = new Thread(ts);
// Run the thread.
myAutomationThread.Start();
----------
Now if you want to start the same thread in Single apartment state then just add the below line of code.
(We need to start the thread in STA because WATiN will run in STA mode only)
myAutomationThread.SetApartmentState(ApartmentState.STA);
The whole piece of code will look like this:
Thread myAutomationThread;
ThreadStart ts = new ThreadStart(delegate() { callMyFun(firstValue,secondValue,thirdValue); });
myAutomationThread = new Thread(ts);
myAutomationThread.SetApartmentState(ApartmentState.STA);
myAutomationThread.Start();
~Jawed
Wednesday, 16 December 2009
How to get Source code of the target web page
Then I thought do we have any alternative to solve this problem?
I searched/goggled somewhere here and there. At last I got some snip of code.
I customize the code in such a way that it helped me in 2 ways.
1. When source code functionally is disable of the target web page/web site.
2. When something failed (no control found) during running of automation code then just get the source code and save it in text file. Latter it would help me to find out why my automation code failed or Check for the controls id/value/text etc on that web page.
Below is the code for that
public void GetSourceCode()
{
try
{
//Target website/web page
string strUrlOfWebPage = "http://jawedm.blogspot.com";
//Location to store source code in text file.
string strTextFileLocation = "c://SourceFile.txt";
System.Net.WebRequest request = System.Net.HttpWebRequest.Create(urlOfWebPage);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)
request.GetResponse();
System.IO.Stream responseStream = response.GetResponseStream();
System.IO.StreamReader readerSource = new System.IO.StreamReader
(responseStream);
string strSourceForTextFile = readerSource.ReadToEnd();
readerSource.Close();
System.IO.File.WriteAllText(strTextFileLocation, strSourceForTextFile);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message.ToString());
}
}
Thanks ,
Md. jawed
Monday, 24 August 2009
Bugs Status Report From Digite Using WATiN
even to get the status we don’t need access of digite :)
All this just a Button click away :)
2. Bugged logged date wise.
We have hosted this web application at http://172.16.200.127/BugStatus/Default.aspx (Access from Aditi LAN only) location to get access from anywhere and by anyone :)
Fig 2. Report sent through Email.
Thanks,
Md.Jawed


