18 August, 2008

My First C# Application :)


This is one of my interesting projects I have ever worked and really enjoyed it to core. I was given the task to create an application which generates a report file taking input from mailbox task, meeting and sent items (based on some keywords in subject line). I found it very interesting and challenging too coz I being the tester first time I was feeling that I am doing some task of development which I always wanted to do. :)

Working with “Outlook Mailbox” is really fun. Problem was how to read tasks and meeting/appointment and create a daily report for the same. The idea of creating this document is to share my excitement and coming up with this document to help someone to give them an insight into how to work in C# to retrieve all items from mailbox. This doc will help to integrate Outlook with Visual Studio with C# language.

Technical Info: To start with we need to add the Microsoft Outlook 12.0 Outlook Library reference to the project. Once we add the reference to our project the Microsft.Office.Core and Outlook assemblies will be added.
Outlook uses MAPI folders to keep track of your e-mail messages, contacts, appointments, tasks and notes. Outlook keeps these files in one of two places, depending on the type of e-mail server you use. Your MAPI file is either in a personal storage folder (.pst) on your hard disk drive or in a mailbox located on the server, if you are using Outlook with Microsoft Exchange server.

Brief about Application: The snapshot of the application is shown below. This application scans the mailbox for meeting request, tasks and sent mails based on “Status” keyword. The application has the functionality of pulling the report from 1st day of week i.e. Monday to the day selected from the calendar control. Application provides the option of saving the report generated in the .txt file in the folder where application is installed. “Open File” button opens the text file for any modifications (if required). It also provides the option of pulling the report for a single day by selecting the checkbox “Single Day” and opens the mail (ready to send) with the body as the report pulled. Just type in the recipients and send it!:)

11 August, 2008

How to select a web service testing tool?

Well this is the first and foremost question which comes to mind when we have a web service testing project. I have just tried to put down my opinion about how to select a tool. There are two things which I will expect from a test tool:

1. Tool which will allow stand alone testing of web services
2. Tool which can be used as a test harness to create different suites of functional and regression test cases.

There are other factors also which influence the selection of tool. I would like to prioritize them like this:

1. Tool allows you to create test cases and Test case Management.
2. Tool allows integration with other frameworks or applications.
3. A good result reporting format.
4. Tool supporting different platforms.
5. Tool should be easy to learn.

02 August, 2008

XML Handling Tips in C#

The XML handling in C# believe me is one of the tricky task.

Sometimes the way we read one of the XML will not work out for the other and will throw some exception and believe me that when you see that the same code works in one program and not the other then trust me you just feel like yelling at Visual Studio. Many times the code I write for one XML file do not works for the other and trust me that really frustrates… J

In this post I will brief about XML loading and how to query XML for 2 most frequently used requirements:

1. Getting a particular node.

2. Getting a particular node along with its child nodes.

So XML handling starts with loading the XML Document.

XmlDocument xDoc = new XmlDocument();

xDoc.Load(@"C:\\Documents and Settings\\Administrator\\Desktop\\Test Sprint\\URL_Config\\Test.xml");

Now the problem starts after loading the document. The problem is with the namespace. Sometimes the document gets loaded properly and sometimes does not. So we need to create a namespace in that document (xDoc here).

XmlNamespaceManager nsmgr = new XmlNamespaceManager(xdoc.NameTable);

nsmgr.AddNamespace("sm", "http://tempuri.org");

Getting a particular node:

To get a particular node we can use the “GetElementsByTagName” method. This method returns the list of nodes having the same tag name as specified.

XmlNodeList categorynodeList;

categorynodeList = xDoc.GetElementsByTagName("Category");

Getting a particular node along with its child nodes:

But to get the list of nodes along with child nodes we need to use bit complex xquery.

XmlNodeList nodeList;

nodeList = root.SelectNodes("//sm:Feed/sm:Item", nsmgr);

It requires one to think smartly of the trees present and how to query to get the node list. There are 2 ways of getting the node list.

1. Using the "GetElementsByTagName” method .

2. Using the “SelectNodes” method.

How to do Web Service Testing ????

Recently I have completed a project on Web Service Testing. Till now I have executed around 10 -12 projects as a Sr. Software Development Engineer in Test but never found any project which is more challenging and interesting when it comes to web service testing.

The entire blog is written into 3 sections:

1. What is Web Service

2. Scope of Testing Web Service

3. Approach to test a web service

What is a web service…

Few months back in a discussion I came across the word “SOA”. I was completely unaware of the word “SOA”; what it is ; how it helps; is it a standard like IEEE etc…

But after the WS testing project, I came to know about SOA. This definition is taken from Wikipedia which I found is the most relevant among the web search I did for defining SOA.

Service-Oriented Architecture (SOA) is a software architecture where functionality is grouped around business processes and packaged as interoperable services.

SOA actually aims at providing a loose coupling of services which underlie applications. It separates functions into different services which are available over a network and can be re-used.

In simple words web services are like an API available over internet to be re-used. So a web service is a system which sits somewhere on a network and all it ever does is service specific requests from clients.

Scope of Testing Web Service…

We can divide web services into 2 categories: one which is used over internet and the one which is used over intranet. The challenging part in web service testing is that they don’t have UI. They are completely UI-less. So this pose a problem that manual testing of web service is going to be a tedious job. But trust me if you are aware of programming and have done some programming then it is going to be the most interesting project. So the foremost condition for web service testing is that one should know programming and have good programming skills.

So the first question which comes to mind is what all I can do in the testing of web services. We can do both Functional Testing & Non Functional Testing. Functional testing will do the data verification part and the non functional testing will look into the response time, scalability issues and performance issues.

Approach to test a web service…

All the web services will either interact with XML as a data source or any database. So functional testing will include providing various input combination and verifying the output result with the source data.

Non Functional Testing will include load and stress testing of the web services. The idea behind the load/stress testing is to figure out how the web service scales as the number of request (clients) accessing it increases. So there are few questions which we need to answer while doing non functional testing like if we double the number of users, do response times stay the same? If we double the number of servers running your web service, does its capacity double?

There are various testing tools available in the market like ANTS, AdventNet QEngine which can be used.

But I prefer using C# and VS 2005 to do the functional testing of web services. NUnit Framework can be used to create test case and execute it . But one has to be good in programming and understand the structure of NUnit.


Till Then ...Bye Good Night ....