Tuesday, December 9, 2014

Selenium Automation Framework Example

Introduction to Automation testing:
Testing is an essential part of a software development process. While testing intermediate versions of products/projects being developed, testing team needs to execute a number of test cases. In addition, prior to release every new version, it is mandatory that the version is passed through a set of “regression” and “smoke” tests. Most of all such tests are standard for every new version of product/project, and therefore can be automated in order to save human resources and time for executing them.
Benefits of using automated testing are the following:
  • Reduction of tests’ time execution and human resources required
  • Complete control over the tests’ results (“actual results” vs “expected results”)
  • Possibility to quickly change test’s preconditions and input data, and re-run the tests dynamically with multiple sets of data
Automation workflow for the application can be presented as follows:
  • First of all it is required to identify tasks that an application has to accomplish.
  • Second, a set of necessary input data has to be created.
  • Third, expected results have to be defined in order one can judge that an application (a requested feature) works correspondingly.
  • Fourth, Executes a test.
  • Finally, Compares expected results with actual results, and decides whether the test has been passed successfully.
Environment Specifications:
  1. Selenium Webdriver (Supports all major browsers, we use Mozilla, chrome and IE)
  2. Eclipse IDE
  3. Java
  4. TestNG
  5. AutoIT Tool (Used to handle Windows popups for Document Uploads and Downloads.)
This Framework has the following tools:
1. Selenium - Selenium is a well know open source testing framework, which is widely used for testing Web-based applications. It has different components and in that Webdriver has rendered the Selenium Remote Control obsolete, and is commonly referred to as Selenium 2.0.
Selenium Webdriver supports most of all browsers to run your test cases and many programming languages like C#, Java, Python, Ruby, .Net, Perl, PHP, etc.. to create and modify your test scripts.
2. Eclipse IDE: Eclipse is an integrated development environment (IDE) for Java. The Eclipse IDE is the most known product of the Eclipse Open Source project.
3. TestNG - Is a testing framework inspired from JUnit and NUnit. It has extended new functionalities which made it more powerful and easier than the other testing frameworks.
It supports ReportNG (simple HTML reporting plug-in) and XLST (Graphical / Pictorial reports) plug-ins to customize or extend the default TestNG reporting style.
4. AutoIT - AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks which is not possible with selenium.
File Formats Used in the Framework:
  1. Properties file – We use properties file to store and retrieve the UI elements of an application or a website and data set file paths. It contains id of the elements, name, xpath or Css selector etc.
  2. Excel files – Excel files are used to pass multiple sets of data to the application.
  3. Xml file – Is used to execute the test scripts. Based on the package or classes or Tests mentioned in the xml file scripts will be executed.
The following figure explains physical structure of files required for Test Automation Framework
Project Structure
The Project Folder Structure: All the basic required folders are created with the sub folders and classes under each folder:--
Automation Project Folder structure
The Following explains the structure in detail:-
UIMap is a concept for defining, storing, and serving UI elements of an application or a website. The UIMap properties file contains a set of ‘key-value’ pairs, where key is an alias of the UI element, and a value is the locator. Click here for more..
Data set stores the data files, Script reads test data from external data sources and executes test based on it. Data sets increases test coverage by performing testing with various inputs and reduce the number of overall test scripts needed to implement all the test cases. Click here for more..
A test is considered as a single action or a sequence of actions, that defines whether a specific feature meets functional requirements. It has multiple test files / packages / class files which will be executed based on the configurations defined in testng.xml. Click here for more..
Test report/results is a document which contains summary of test activities. After execution is completed, it is very important to communicate the test results and findings to the project manager and with that decisions can be made for the release. Click here for More..
In order to create a test suite and run separate test cases, we need framework which drives the automation. Here testng.xml can be called as "driver" which drives several test cases automated using selenium code. Advantage of using TestNG with Selenium is of running multiple test cases from multiple classes using xml configuration file .Click here for More..

Difference between Selenium RC and Selenium Web driver

Difference between Selenium RC and Selenium Web driver

 Difference between Selenium RC and Selenium Web driver.

Selenium RC
Selenium Web driver

Selenium RC’s architecture is way more complicated.

Web Driver’s architecture is simpler than Selenium RC’s.
Selenium RC is slower since it uses a JavaScript program called Selenium Core. This Selenium Core is the one that directly controls the browser, not you.
Web Driver is faster than Selenium RC since it speaks directly to the browser uses the browser’s own engine to control it.
Selenium Core, just like other JavaScript codes, can access disabled elements.
Web Driver interacts with page elements in a more realistic way.
Selenium RC’s API is more matured but contains redundancies and often confusing commands.
Web Driver’s API is simpler than Selenium RC’s. It does not contain redundant and confusing commands.
Selenium RC cannot support the headless HtmlUnit browser. It needs a real, visible browser to operate on.
Web Driver can support the headless HtmlUnit browser.
Selenium RC Has Built-In Test Result Generator. Selenium RC automatically generates an HTML file of test results. 
Web Driver has no built-in command that automatically generates a Test Results File.
Selenium RC needs the help of the RC Server in order to do so.
web Driver directly talks to the browser
Selenium RC can support new browsers
It cannot readily support new browsers

Monday, October 20, 2014

Java Video Lecture:

Learner TV Java Videos


Java Programming Tutorial - 2 - Running a Java ProgramProgramming7 minClick to view videos
Java Programming Tutorial - 3 - Downloading EclipseProgramming7 minClick to view videos
Java Programming Tutorial - 4 - Hello WorldProgramming8 minClick to view videos
Java Programming Tutorial - 5 - VariablesProgramming7 minClick to view videos
Java Programming Tutorial - 6 - Getting User InputProgramming6 minClick to view videos
Java Programming Tutorial - 7 - Building a Basic CalculatorProgramming7 minClick to view videos
Java Programming Tutorial - 8 - Math OperatorsProgramming6 minClick to view videos
Java Programming Tutorial - 9 - Increment OperatorsProgramming5 minClick to view videos
Java Programming Tutorial - 10 - If StatementProgramming6 minClick to view videos
Java Programming Tutorial - 11 - Logical OperatorsProgramming6 minClick to view videos
Java Programming Tutorial - 12 - Switch StatementProgramming7 minClick to view videos
Java Programming Tutorial - 13 - While LoopProgramming4 minClick to view videos
Java Programming Tutorial - 14 - Using Multiple ClassesProgramming7 minClick to view videos
Java Programming Tutorial - 15 - Use Methods with ParametersProgramming7 minClick to view videos
Java Programming Tutorial - 16 - Many Methods and InstancesProgramming8 minClick to view videos
Java Programming Tutorial - 17 - ConstructorsProgramming6 minClick to view videos
Java Programming Tutorial - 18 - Nested if StatementsProgramming5 minClick to view videos
Java Programming Tutorial - 19 - else if StatementProgramming5 minClick to view videos
Java Programming Tutorial - 20 - Conditional OperatorsProgramming3 minClick to view videos
Java Programming Tutorial - 21 - Simple Averaging ProgramProgramming6 minClick to view videos
Java Programming Tutorial - 22 - for LoopsProgramming4 minClick to view videos
Java Programming Tutorial - 23 - Compound Interest ProgramProgramming7 minClick to view videos
Java Programming Tutorial - 24 - do while LoopsProgramming3 minClick to view videos
Java Programming Tutorial - 25 - Math Class MethodsProgramming5 minClick to view videos
Java Programming Tutorial - 26 - Random Number GeneratorProgramming5 minClick to view videos
Java Programming Tutorial - 27 - Introduction to ArraysProgramming7 minClick to view videos
Java Programming Tutorial - 28 - Creating an Array TableProgramming6 minClick to view videos
Java Programming Tutorial - 29 - Summing Elements of ArraysProgramming4 minClick to view videos
Java Programming Tutorial - 30 - Array Elements as CountersProgramming9 minClick to view videos
Java Programming Tutorial - 31 - Enhanced for LoopProgramming4 minClick to view videos
Java Programming Tutorial - 32 - Arrays in MethodsProgramming6 minClick to view videos
Java Programming Tutorial - 33 - Multidimensional ArraysProgramming4 minClick to view videos
Java Programming Tutorial - 34 - Table for Multi ArraysProgramming7 minClick to view videos
Java Programming Tutorial - 35 - Variable Length ArgumentsProgramming5 minClick to view videos
Java Programming Tutorial - 36 - Time ClassProgramming9 minClick to view videos
Java Programming Tutorial - 37 - Display Regular timeProgramming7 minClick to view videos
Java Programming Tutorial - 38 - Public, Private and thisProgramming6 minClick to view videos
Java Programming Tutorial - 39 - Multiple ConstructorsProgramming8 minClick to view videos
Java Programming Tutorial - 40 - Set and Get MethodsProgramming7 minClick to view videos
Java Programming Tutorial - 41 - Building Objects for ConstructorsProgramming8 minClick to view videos
Java Programming Tutorial - 42 - toStringProgramming8 minClick to view videos
Java Programming Tutorial - 43 - CompositionProgramming9 minClick to view videos
Java Programming Tutorial - 44 - EnumerationProgramming10 minClick to view videos
Java Programming Tutorial - 45 - EnumSet rangeProgramming7 minClick to view videos