Monday, October 11, 2010

Testing Process in QTP

  1. Analysing Application
  2. Create Test Scripts
  3. Enhancing Test Scripts
  4. Running Test Scripts
  5. Analysing Test Results

Analysing Application: Determine the various activities that customers perform in your application, to perform a particular task.

Divide the business process into smaller units which will be represent by test actions.

Each action should emulate an activity that a customer might perform while using your application.

Creating Test Scripts: Create a Test script, by recording a manual Test Scenario, in Application Under Test (AUT)

Enhancing Test Scripts

Running Test Scripts: QTP Connects to website or AUT and performs each operation in the test as performed manually while creating/recording tests.

Analysing Test Results: QTP Test Results are analysed.

Sunday, October 10, 2010

CoolTuts - JavaScript - Strings

Concatenating Strings: To concatenate strings we use '+' operator

public class exercise{
public static void main(String[] args)
{
String FirstString = "Abc"
String SecondString = "def"
String FinalString;
FinalString = FirstString + SecondString;
System.out.println("Cancatenated String "+ MyString);
}
}

Length of the String: Returns the number of characters in the String.
String myStr = "abc"
System.out.println("Length of the string "+myStr.length());

IndexOf: Returns the position of the character in the String
String myStr = "abcdefg"
System.out.println("Position of the character "+myStr.IndexOf("c"));//Returns 2
System.out.println("Position of the character "+myStr.IndexOf("z"));//Returns -1 as character is not present in string

Thursday, October 7, 2010

File Upload Server Control

This control is used to upload a file and save file to a specific location using some properties.
A typical File Upload Control is constructed in the following manner:

<asp:FileUpload ID="FileUpload1" runat="server" />

For an Example of using FileUpload control and to save on local computer.



I am using extra button control and one label control.

.aspx

<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" />
<br />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>

.cs

protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
try
{
FileUpload1.SaveAs("C:\\Uploads\\"+FileUpload1.FileName);
Label1.Text = "File name: " +
FileUpload1.FileName + "<br/>" +
FileUpload1.PostedFile.ContentLength + " kb<br/>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
}
catch(Exception ex)
{
Label1.Text = ex.Message.ToString();
}
}
else
{
Label1.Text = "You have not added a file";
}
}

You can check whether your file uploaded to your local folder or disk.

If you see your file that’s it you are done with this control.

Thanks
Emmaneale Mendu
Web Developer

ASP PlaceHolder Control

A Placeholder as its name implies – it is a placeholder for controls or objects.

To see how it works, insert a PlaceHolder control into your page and then add controls to it from your server-side code in the manner shown below.

.aspx

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

.cs

Label lblMessage = new Label();
lblMessage.Text = "Hello World I am Cool";
PlaceHolder1.Controls.Add(lblMessage);

Here we are creating a new instance of Label control and adding it to placeholder control. You can add more than one control to a single instance of a PlaceHolder control.

Thanks
Emmaneale Mendu
Web Developer.

ASP Panel Server Control

This control is used to display a set of controls in one unit. It is basically a wrapper for other controls, enabling you will get group of server controls along with other elements like images etc.

The new feature in the panel control is the capability to scroll with scrollbars that appear automatically depending on the amount of information that panel control holds.

For a example below Figure shows where panel holds table control



<asp:Panel ID="Panel1" Width="100px" Height="100px" ScrollBars="Auto" runat="server">
<table>
<tr>
<td>
This text is to test the scrollbar in panel control.
If this text extends the limit of the panel control
the scrollbars appear
</td>
</tr>
</table>
</asp:Panel>


You can add controls dynamically too.

.cs

Label lblMessage = new Label();
lblMessage.Text = "Hello I am new to Panel control";
Panel1.Controls.Add(lblMessage);

That’s it a small explaination on panel control keep reading.

Thanks
Emmaneale Mendu
Web Developer

ASP AdRotator Server Control

This control is used to display collection of advertisements simultaneously, this control automatically rotating advertisements when web page is refreshing, AdRotator control the Microsoft designed based on extensible markup language (XML). So we use XML data to this AdRotator Control.

Right click on your solution file and select add New Item, there you select XML file then press OK.

In xml file add the below code.
<Advertisements>
<Ad>
<ImageUrl>~/Images/CoolTuts.JPG</ImageUrl>
<NavigateUrl>http://www.cooltuts.com/</NavigateUrl>
</Ad>
<Ad>
<ImageUrl>~/Images/PleaseWait.JPG</ImageUrl>
<NavigateUrl>http://www.desibindaas.com/</NavigateUrl>
</Ad>
<Ad>
<ImageUrl>~/Images/Submit.JPG</ImageUrl>
<NavigateUrl>http://www.bing.com/</NavigateUrl>
</Ad>
</Advertisements>

The elements we use mainly in this XML file is explained below.

ImageUrl: Location of your Image.
NavigationUrl: Where to navigate when the image is clicked.
AlternateText: This is useful when there is now image in your file.
Impressions: this indicates the likelihood of the image getting selected for display.
Keyword: this sets the category of the image in order to allow for the filtering of ads.

After adding a XML file to your project with adding above code in it. Its time to add AdRotator to your page with having a property AdvertisementFile=”XML File” as shown below.

<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/XMLFile.xml" />

Hence you see by refreshing the web page. The Ads are changing according to your impression element timings.

Thanks
Emmaneale Mendu
Web Developer.

ASP Literal Control

This control is used to display some text on web page. Same as label control but only difference between these two controls is style property. It won’t allow keeping any styles to the control.

A typical Literal control is written to the page in the following manner.

<asp:Literal ID="Literal1" Text="Hello World!" runat="server"></asp:Literal>

Thanks
Emmaneale Mendu
Web Developer