Sunday, 1 December 2013

How to do mobile Testing - Overview

The following screen shot gives a good overview of how to do Mobile Testing.

Thursday, 3 October 2013

Accessing Forms in WebDriver Part-1

In this article, we are going to learn, how the WebDriver access the forms.

As we know that the forms contains different elements such as Radio Button,Checkbox,Text/Input Box,Drop-Down List, Links etc. We are going learn, how the WebDriver access all these elements in this article.

Links:
Links are accessed by using the click() method.


Example:Consider the following link found in Yahoo home page.

           
We can access the link using "LinkText()" or "PartialLinkText()" with the combination of "click()" method. We can use either of the following 2 lines to access the "SIGN IN" link marked above.

PartialLinkText() method:
driver.FindElement(By.PartialLinkText("SIGN")).Click();
 
LinkText() method:
driver.FindElement(By.LinkText("SIGN IN")).Click();

Radio Button:
Radio Button can also be toggled using click() method.

Example:Consider the following Radio buttons.
                               
We can toggle anyone of the above shown radio button using click method.The following code snippet toggle the Red radiobutton option.

driver.FindElement(By.CssSelector("input['value=Red']")).Click();

Input Box:
Input Box refers either of the following 2 types of fileds.
  •  Text Fields: Text fields accepts the values typed by the user and shows as it is.[Ex:Username field in login screen.]
  • Password fields: Password fields also accepts the values typed by the user and displays in encrypted format to maintain the security as the password is a sensitive from user's point of view. 
 The following picture depicts the Text and Password fields.
                 

Entering values in Input Box:
We can enter values in the Input Box by using SendKeys() method.

Code:
driver.FindElement(By.Name("Username")).SendKeys("test");
The above code will type the text "test" in Username field.

Deleting the values from Input Box:
We can delete values from the Input Box by using clear() method.

Code:
driver.FindElement(By.Name("Username")).clear();
The above code will clear the text "test" from Username field.

Monday, 30 September 2013

WebDriver Script in C#

Guru(s)/Reader(s), we have seen the introduction of Web Driver and its installation with C# in my previous articles. Now, we are going to code our First Web Driver Script in C#.

Requirement:
01.Navigate to Google Home page.
02.Enter some Url in the Search box.
03.Verify the result.
04.Close the browser before ending the entire program.



WebDriver Code: 
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

#region
//OpenQA.Selenium - Contains the WebDriver class needed to instantiate a new browser loaded with the specific browser. Here we used, Firefox browser.
//OpenQA.Selenium.Firefox - Contains the FirefoxDriver class needed to instantiate a Firefox specific driver onto the browser instantiated by the WebDriver class.
//We can include more namespaces based on our requirement like, manipulating external files,taking screen shots etc.
 #endregion

namespace ConsoleApplication1
{
    class FirstWebDriverScript
    {
        static void Main(string[] args)
        {
           //Declaration of application related variables.
            String _baseUrl = "http://www.google.com";
            String _boxGoogleSearch = ".//*[@id='gs_htif0']";
           
            //Create a new instance of the Firefox driver,Observe that the above Firefox  class has no parameters. It means that the default Firefox profile will be launched by the program. The default Firefox profile is similar to launching the Firefox in safe mode(i.e., no extensions).
            IWebDriver idriver = new FirefoxDriver();
           
            //Navigate to the Google.com page
            idriver.Navigate().GoToUrl(_baseUrl);

            //Maximizing the browser Window
            idriver.Manage().Window.Maximize();
           
            //Searching for the Google Search box by using XPath
            IWebElement _googleSearch = idriver.FindElement(By.XPath(_boxGoogleSearch));
           
            //Entering the search string in Google Search Box
            _googleSearch.SendKeys("software-testing-community.blogspot.in");
            _googleSearch.Submit();
           
            //Comparing the title with the expected value
            if (idriver.Title.Contains("software-testing-community"))
            {
                Console.WriteLine("Test passed");
            }
            else {
                Console.WriteLine("Test Failed");
            }

           //Closing the Browser
            idriver.Close();

            //Releasing all application-defined tasks with freeing, releasing, or resetting unmanaged resources.
            idriver.Dispose();
           
        }
    }
}

The WebDriver's code and its explanation is included as part of the comments. Please feel free to add your comments/ suggestions.

Friday, 27 September 2013

Introduction to Selenium WebDriver



This article gives the details about the WebDriver. 
WebDriver is a Web Automation tool which is used to run the Tests across different browsers[Ex: IE, Firefox,Chrome, Opera etc.]. WebDriver is the new feature in Selenium 2.0.WebDriver also allows/enables us to user different programming languages like Java, .Net, Ruby,PHP, Python and Perl in creating our test scripts.
It’s not mandatory to work all the above mentioned programming languages to work on WebDriver. We just need to be knowledgeable on anyone of the programming language.

WebDriver’s Architecuture:
WebDriver has a very very simple architecture. The following picture depicts the WebDriver’s architecture.


WebDriver controls the Browsers from OS level. The main required thing is that the programming language’s IDE should contain the Selenium commands and a browser.

WebDriver Features:
  • WebDriver is faster as it directly speaks to the browser as well as the uses the browser’s engine to control the same.
  • WebDriver interacts with the application’s elements in a realistic way. WebDriver can’t really enter a value in a Textbox/ Text area if it’s disabled on the web page that we’re testing.
  • WebDriver’s API is very simple as well as easy for understanding. Because, it doesn’t contain redundant and confusing commands.
  • WebDriver can drive an invisible browser called HtmlUnit.
HtmlUnit: HtmlUnit browser is called as “Headless” / Invisible browser as it doesn’t have the GUI. Generally it’s very fast as it doesn’t waste the time in loading page elements. It’ll be helpful in executing the Test for n-number of cycles in a quick period of time. HtmlUnit can be controlled via Automation only as it’s invisible.

Limitations:
WebDriver has certain limitations.
  • WebDriver has no built-in command that automatically generates the Test Result Report/File. We need to rely on the IDE’s output window or write our own code to generate the report as per our requirement. For example, we can customize our output in the form of HTML, Excel or Notepad etc.
  • WebDriver can’t readily support the new browsers. As we know that the WebDriver operates on the OS level. We know that the each browser communicate with the OS in different ways.  The new browser may communicate with the OS in a different process than the old process followed by the older version of the same browser. So, the WebDriver team need take a decision and work towards it to support the new version.

WebDriver With C#


This article explains the steps to be followed to setup the Selenium WebDriver with C#.
 Prior to Selenium 2.2.0, all Selenium C# bindings were distributed as unsigned dlls. But, currently, the C# Bindings are distributed as the signed DLLs along with their dependency DLLs.
The following steps to be followed to setup the Selenium WebDriver with C#.
  • The C# bindings(named as “selenium-dotnet-strongnamed-2.35.0.zip”) can be downloaded from https://code.google.com/p/selenium/downloads/list .
  • Launch Microsoft Visual Studio and navigate to File> New> Project and observe that the following window is opened.

  • Select Class Library from the list and enter the Soultion name as “WebDriverWithCS” as shown in the above picture.
  • Right click on the Solution name “WebDriverWithCS” in “SolutionExplorer” and click on “Add Reference” option and observe that a Window is opened to select the DLLs as shown  below.
  • Click on the Browse button and traverse to the path where the unzipped files[Step#01] are placed, and select all the files and the click on “OK” button.
  • Observe that the Dotnet DLLS are added and displayed under  “Solution Explorer”> Solution name()> References” section as shown below.  
  • Just type the following lines of code just above the namespace.
                 using OpenQA.Selenium;
                 using OpenQA.Selenium.Firefox;
                 using OpenQA.Selenium.Support.UI;
Now we are set to write our Selenium C# script on Firefox.

Please feel free to add more comments to this article.

Thursday, 26 September 2013

Difference between Selenium IDE, Selenium RC, Selenium Webdriver

This articles explains the basic differences between the Selenium IDE,Selenium Remote Control Server and Selenium WebDriver.

S.No Selenium IDE Selenium RC Selenium WebDriver
  1 Only works on Firefox. Works almost on all browsers.(IE,Opera,Firefox,Chrome).But doesn't work on the latest version of IE and Firefox. Works on all versions of IE,Firefox,Chrome,Opera.
  2 Supports Record and Playback. Doesn't support Record and Playback. Doesn't support Record and Playback.
  3 No Server is required to start. RC Server is required to start. No Server is required to start.
  4 JavaScript based Core Engine. JavaScript based Core Engine. Interacts natively with all browsers.
  5 Simple to use. It requires knowledge on JavaScript if User extensions are used,which makes the work little bit tougher. Simple and small API. Complex and a little bit large API when comparing with RC.
  6 Not at all Object Oriented. Less Object Oriented API. Purely Object Oriented API.
 7 Can't move mouse cursor with this. Can't move mouse cursor with this. Can move mouse cursor with this.
 8 No listeners. No listeners. Implementation of listeners are provided.
 9 Full XPath of the elements need to be appended with 'XPath =\\' syntax. Full XPath of the elements need to be appended with 'XPath =\\' syntax. No need to append the full Xpath of the elements.
 10 iPhone Applications can't be tested. iPhone Applications can't be tested. iPhone Applications can be tested.
 11 Android Applications can't be tested. Android Applications can't be tested. Android Applications can be tested.

Please feel free to write your comments as well as please let me know if I missed/misinterpreted on anything :).

Tuesday, 17 September 2013

Tips to be a Champion Tester

As we know that the Testers always feel tremendous pressure when the product release is around the corner. Product Release is a milestone for any Tester irrespective of the amount of Testing have been conducted. So, it’s all about testing well in a tough situation and delivering a quality product which in turn will be shipped to the client. It’s when we have to find and report all the issues in the application and get it fixed by the Development team.
 
We know that the Testing is important throughout the SDLC. But it suddenly becomes the most important activity of all, once the product is getting ready to be released. So, the pressure mounts on the Testers to some extent. So, it needs lot of skills and experience to handle such kind of situations.
We need give more attention to the following areas during such kind of situations.
 
Functionality:
Find out the improper/missing functionality and get them fixed by the Development Team as soon as possible. 
 
Crash Issue:
Generally the product will not be accepted if the software is getting crashed itself or crashing the user’s system. So, we should test all scenarios that may cause the system crash. For example, we need to test the scenarios like Memory Leaks, DLLs, missing files due to bad 3rd party installer etc.
 
Smoke Test:
Smoke Testing to be conducted on daily basis to find the new problems and get it fixed.

Usability Errors:
Execute all possible navigation paths in your application to catch the Usability errors. 

Bugs/Test Cases/Bug Fixes tracking:
We need to regularly keep track on the priority bugs/test cases/bug fixes. This ensures that the important bugs are dealt first.
Recover Testing:
Recovery scenarios may not be handled properly in some of the applications which will lead to the loss of the data or inconsistent results.So, we should make sure that the recovery scenarios are executed properly. 
 
Regression Testing:
Regression testing to be conducted on the related modules whenever the issues are fixed.It’ll be helpful in avoiding the major issues at the final moment.
 
Cross Verification With Team(Peer Review): 
Some fixes may not be clear to a particular Testers. It’s always to have a 3rd eye on such kind of areas to avoid unnecessary issues during the latter part of the product release.
 
Deferred Issues:
Sometimes the organization used to defer some of the issues. Such kind of issues need to be handled in the future releases. So, we should make sure that the issues deferred in the previous release are fixed in the current release.
The above items are generic list. Please feel free to suggest more points :) .

 
Back To Top