Wednesday, November 23, 2016

My First Script Using Selenium IDE

Launch Firefox and Selenium IDE 

Type the value for base url witch you need to automate. (Ex: http://www.seu.ac.lk/)
Select the record button to record (if already not selected)


In Firefox navigate to the http://www.seu.ac.lk/ url

To verify the page right click on any blank space within the page. Make sure not click on any hyperlinked objects or images. That will open the Selenium IDE context menu.  In selenium IDE context it will show few commands. To get entire list select “Show Available Commands”


Select “assertTitle South Eastern University of Sri Lanka - SEUSL” option. This is makes sure that the page title is correct.




Next Click at “life@SEU” link and verify the page title using the “verify title Life @ SEU | SEUSL” command

Next click on Blog link and there select the “Hello World”

Stop the recording by unselecting the record button. The script looks like below



You can save the script using the Ctrl+ s or by selecting the  save test case option in filemenu. Notice that file save in HTML format.

To check the stability of your script can use the play back option. Once you click the playback option it will execute the whole script. All the test steps  would be color in green for the successful run. For unsuccessful execution or failure, the failed test step would be highlight in red. And the test case pane failure shows as 1.

Tuesday, July 19, 2016

Selenium IDE

Download and Install Selenium IDE:
To get start navigate to http://seleniumhq.org/download/ link and download the Selenium IDE and install it. When you installing the Selenium IDE, for security, Firefox notification will popup. Click on Allow and continue installation. 
Once the Installation has finished you can start the Selenium IDE by Clicking the Selenium IDE icon on the Firefox menu or by pressing Ctrl + Alt + S

Features of Selenium IDE:

Menu Bar:
The Top most portion is Menu Bar. It contains File, Edit, Actions, Options, Help menus. Menu Bar can be used to create, modify, and export test cases into different formats that use by Selenium RC and WebDriver.

File Menu:One of the most importance feature in the file menu is “Export”. Because it allows us to change the Selenium IDE test case file format into different formats which can run on Selenium RC and WebDriver. There are two option to Export
“Export Test Case As…”: Export currently open test case
“Export Test Suite As…”: Export currently open test suite.
“Export” option have multiple options in the following format:  file format which need to exported/ unite test framework to be used/ selenium framework to be used on the exported test case

Edit Menu:Edit Menu have copy, paste, delete, cut undo, Redo, SelectAll, Insert New Command, Insert New Comment. Newly inserted command and comments will place top of selected line. Commands are colored black. Comments are colored purple.

Actions:Under the Actions you can find many option related to record and play.

Options:It provides interface for configuring various setting. The Clipboard Format option allows to select the Selenese command from the editor and paste it as a code snippet. The default is HTML you can select as your need.

Base URL Bar: 
The Base URL is useful in accessing relative URLs.

Tool Bar:
It contains following in the order:
Playback Speed controller: This controls the speed of Test Script Execution.
Play entire test suite: This sequentially play all the test cases listed in the Test Plan
Play current test case: This play only the currently selected test case.
Pause/Resume: This pause or resume test case.
Step: This button allows to step into each command in test script. Basically it used debug the script.
Apply rollup rules: This is an advanced functionality. It allows to group Selenese commands together and execute them as a single action.
Record: This starts/ends your recording session.  Each browser action is entered as a Selenese command in the Editor.

Test Case Pane:
List the Currently Opened test cases. If you open test suite it list, the all the test case in test suite. Currently selected one is in bold. If the test case passed it shows in Green color and if it fails, it show in Red. The bottoms show the summery of test cases.

Editor:
Show the recorded commands. It is available in Table and Source views. In the Table view it shows three elements for each Command, those are
Command: Describe name of command
Target: Describe the Target, may be name, id or Xpath
Value: Shows value for element.
In Source view it display steps in HTML format.

Log:
Display runtime message during the execution time.

Reference:
Shows concise description of the currently selected Selenese command in the Editor. It also shows the description about the locator and value to be used on that command.

Friday, May 27, 2016

Introduction to Selenium

Selenium is an open source Automation testing tool. Which is used to test web applications and it is not support for windows based applications. Selenium is not a single tool, which is consists of different set of tools, each tool is full filling the different testing needs of an organization. QPT (Quick Test Professional) can used to automate web application and windows application but it is Licensed Tool. Selenium is strong and open source, so most of the companies choose Selenium whenever they want to automate Web applications.It has the below components,

Selenium IDE: It is an integrated development environment for Selenium Script. It is a Firefox extension, which is provides record and playback facility to regression test in a web application. The interesting feature is users no need the programming language skills to use it. Even though it is good for linear scripting it is not good enough for effective test scripting because it doesn’t support for looping concepts and cannot customize. But users can export recoded script in many languages like C#, Java, Python, Ruby and users can used it in selenium RC or Webdriver. Test Case is a single test script create in Selenium IDE and set of Test Cases are called as Test Suite


Selenium RC: Selenium RC address the limitation on Selenium IDE. It allows various programming languages like (Java, PHP, Perl, Python, Ruby) to automate web applications. Simply saying Selenium IDE is support for the linear execution but does not support any logical statements and iterations. But in the real world scenario we needs more then linear execution, for example we need conditional statements, iterations, exception handling, test reporting, database testing, capturing screen shots of failed tests, test case grouping and etc. for these kind of needs Selenium RC is very useful. Selenium RC is helps us to handle complex logic in test case.

Selenium Webdriver: The Selenium Webdriver is better than Selenium IDE and Selenium RC in many aspects. It’s support for many different browsers and different programming languages. It makes direct calls to the browser using each browser's native support for automation. Webdriver was developed to better support dynamic web pages like Ajax.

Selenium Grid: Selenium Grid supports to run multiple test across different browsers, operating system and machine in parallel. Simply saying it allows to run large test suites on multiple environments. Selenium Grid uses a hub-node concept where you only run the test on a single machine called a hub, but the execution will be done by different machines called nodes.This has following advantages:
  • By using selenium grid we can save the execution time of large slow running test suite – by parallel execution
  • Can test against different browser, operating system in parallel



At the moment, Selenium RC and WebDriver are merged into a single framework to form Selenium 2. Selenium 1, by the way, refers to Selenium RC.

Friday, April 22, 2016

Types of Automation Testing Frameworks

There are various types of Automation Frameworks available now days. Those are categorized based on their support to different key factors to do automation like re-usability, scalability, ease of maintenance etc. Some of them are:
  1.  Data-Driven Testing Framework
  2. Module Based Testing Framework
  3. Keyword- Driven Testing Framework
  4.  Test Library Architecture Framework
  5.  Hybrid Testing Framework
The Data-Driven Testing Framework
In this framework test data and the logic is maintains separately. Here the logic lies in the test script and it lets the user store the test data into an external files (Excel Files, Text Files, CSV Files, ODBC Sources, DAO Objects). Test data is read from the external files and are loaded into the variables inside the test script. Variables are used both for input values and for expected result values.
The simplest example for Data-Driven Testing Framework is “Login” functionality of a system. Where we testing login function with deferent set of user name and password.



Module Based Testing Framework
The basic concept behind Module Based Testing Framework is abstraction. Here application under test is divides into number of logical and isolated modules. Under each module we involve the creation of independent and separate test script. These modules are used to build the large test scenarios.  The main concern of this framework is the component are separated by the abstraction layer in such a way that the changes made to the one component of the application do not affect other component


Keyword- Driven Testing Framework
Keyword Driven Testing Framework is an application independent framework, it used data tables and keywords to explain the actions to be performed on the application under test. Here test can be design with or without the application. Here we divide the entire test case into Keywords and test steps are assigned to specific keywords. Keywords are reusable.
Keyword: Keyword is an Action that can be performed.
Ex: GUI Component Textbox - InputText, VerifyValue, VerifyProperty


Test Library Architecture Framework. 
The library architecture testing framework is similar to modular based testing frame work. Basically it is built on Modular Based Testing framework with some additional advantages. Here instead of dividing application under test into test scripts, divides into functions, these functions can be used in any part of application under test. Therefore framework creates a common library for common functions in application under test. So, these libraries can be called within the test scripts whenever required. The basic fundamental behind the framework is determine the common steps and group them into functions under a library and call those functions in the test scripts whenever required.
Simple example is “Login” function instead of writing again and again we kept into a library.

Hybrid Testing Framework
This is the most commonly implemented framework, basically it is a combination of more than one framework mentioned above. In Hybrid Testing Framework tests are fully scripted so it increase the automation efforts  

Thursday, April 14, 2016

Introduction to Test Automation Framework

The biggest challenge the software developer’s facing is building quality products within the timespan and cost constrain. The quality software need to be a bug free one. So to make sure the quality of the product everyone using testing. In many software projects most of the time we are giving importance to test new developments and we are neglecting the regression testing (Regression testing is a testing that verifies that software that was previously developed and tested still performs correctly after it was modified and make sure the system still meets its requirements). The reason for neglecting the different type of testing is time or cost constrains. Due to this they end up with bad quality products. To avoid this circumstance and to simplify the testing, most of the companies today moving towards the automation testing.

What is a Framework?

Framework is a conceptual structure to provide guidelines to build something useful manner. Frameworks give us a layered structure indicating what kind of works we can do and how its inter related.  In computer system it’s indicating what kind of program we can build and how can interrelate. Basically is set of protocols, rules and standards. 
Let us move on to our topic.

What is Test Automation Framework?

Test Automation Frameworks is an execution environment for the automation test scripts. It has set of guidelines for coding, test data handling, precondition handling, report handling etc.…. if we followed those we can get beneficial outcome. By using Test Automation Framework we can get more benefits. Those are:
  • Increase the reusability of code and ease of scripting
  • Need minimum manual intervention
  • Low cost of maintenance
  • Easy to handle test data and reporting
  • Increase scalability, modularity and understandability  

What is Automation Testing?

Automation Testing is a process in which Automation Tool is used to execute pre-scripted test cases in controlled and desired manner to make sure the system works as expected before it is released into production. In  general Automation Testing is process of automating a manual test process which is already in place in system. 

Automated testing is important due to following reasons:
  • Manual Testing of all work flows and  all fields is time and cost consuming
  • It is difficult to test for multi lingual sites manually   
  • Automation does not require mutch Human intervention. You can run automated test overnight
  • Automation increases  speed of test execution
  • Automation helps increase  Test Coverage
  • Manual Testing can become boring and hence error prone.

Which Test Cases to Automate?

Test cases to be automated can be selected using the following criterion to increase the automation ROI
  • High Risk - Business Critical test cases
  • Test cases that are executed repeatedly
  • Test Cases that are very tedious or difficult to perform manually
  • Test Cases which are time consuming