Saturday 19 September 2015

Java required by Selenium Automation

#Java #TheBuddhaTree #SeleniumWebDriver

After many of requests/questions from our readers that how much Java is needed for working on Selenium WebDriverHere we are listing all the Java topics, which you should know before start working on Selenium WebDriver.

Introduction to Computers and Java
•       Introduction
•       Computers: Hardware and Software
•       Machine Languages, Assembly Languages and High-  Level Languages
•       Introduction to Object Technology
•       Operating Systems
•       Programming Languages
•       Java Development Environment
•       Test-Driving Java Application

Introduction to Java Applications
•       Introduction
•       Write Your First Program in Java
•       Modifying Your First Java Program
•       Displaying Text
•       Adding Integers
•       Memory Concepts
•       Arithmetic
•       Decision Making: Equality and Relational
•       Conditional Operators

Introduction to Classes, Objects, Methods and Strings
•       Introduction
•       Declaring Class with Method and Instantiating Object of a Class
•       Declaring a Method with Parameter
•       Instance Variables, set getter Methods
•       Primitive vs. Reference Types
•       Initializing Objects with Constructors
•       Floating-Point Numbers and double

Control Statements:  Part  1
•       Introduction
•       Algorithms
•       Control Structures
•       if Statement
•       if...else Statement
•       while Statement
•       Compound Assignment Operators
•       Increment and Decrement Operators
•       Primitive Types

Control Statements: Part 2
• Introduction
• Essentials of Counter-Controlled Repetition
• for Repetition Statement
• Examples Using the for Statement
• do...while Repetition Statement
• switch Multiple-Selection Statement
• break and continue Statements
• Logical Operators
• Structured Programming Summary

  Methods
• Introduction
• Program Modules in Java
• static Methods  and static Fields
• Methods with Multiple Parameters
• Method-Call Stack and Activation Records
• Argument Promotion and Casting
• Java API Packages
• Scope of Declarations
• Method Overloading

Array
• Introduction
• Arrays
• Declaring and Creating Arrays
• Arrays Examples
• Enhanced for Statement
• Passing Arrays to Methods
• Multidimensional Arrays
• Limitation of Array

Classes and Objects: In Detail
• Introduction
• Controlling Access to Members
• Referring to the Current Object’s Members with this  Reference
• Overloaded Constructors
• Default and No-Argument Constructors
• Setter and Getter Methods
• Composition &  Enumerations
• Garbage Collection and Method finalize
• static Class Members
• static Import
• final Instance Variables
• Creating & Accessing package

Inheritance
• Introduction
• Superclass and Subclass
• protected Members
• Relationship between Superclass and Subclass
• Constructors in Subclasses
• Class Object

Polymorphism
• Introduction
• Polymorphism Examples
• Polymorphic Behavior
• Abstract Class and Method
• final Method and Class
• Using Interfaces

Exception Handling
• Introduction
• Example: Divide by Zero
• When to Use Exception Handling
• Java Exception Hierarchy
• finally Block
• Obtaining Information from an Exception Object
• Chained Exceptions
• Declaring New Exception Types
• Preconditions and Post-conditions
• Assertions

Strings, Characters and Regular Expressions
• Introduction
• Fundamentals of Characters and Strings
• Class String
• String operation
• Class Character
• Tokenizing Strings
• Regular Expressions, Class Pattern and Class Matcher
  
Files, Streams and Object Serialization
• Introduction
• Files and Streams
• Class File
• Sequential-Access Text Files
• Object Serialization
• Additional java.io Classes

Generic Collections Classes & Methods
• Introduction
• Collections Overview
• Type-Wrapper Classes for Primitive Types
• Autoboxing and Auto-Unboxing
• Interface Collection and Class Collections
• Lists
• Collections Methods
• Sets
• Maps
• Properties Class
• Synchronized Collections
• Un-modifiable Collections


• Abstract Implementations

Saturday 12 September 2015

Selenium Integration with Jenkins

#thebuddhatree #Selenium #WebDriver #Maven #Jenkins

The Problem
Running your Selenium project from CI tools like Jenkins.

A Solution
In order to integrate Selenium project with Jenkins, you need to manually configure Jenkins job. Let's step through how to do it and make sure it's working.

An Example 
Install Maven in Eclipse, after that create a Maven project for your Selenium. To do that 
  1. Open Eclipse
  2. Create a Maven project
  3. Update POM.XML file with required dependency
  4. Write your Selenium WebDriver code
  5. Make sure code is running
  6. Follow below given steps 

Manorama Yearbook 2015 (Book & CD)
Step 1


Step 2



Step 3



Step 4



Step 5



Step 6




Expected Behavior
Scion of Ikshvaku (1st Part in Ram Chandra Series)
When you build your project from Jenkins, here is what will happen -

  • Build is created & Success message is displayed
Conclusion
Keep in mind that your Maven project should be running successful from local machine.

Note - If any doubt/query/suggestion, pls post in forum - Testing Forum

Happy Learning!




SeleniumFramework - A simple web testing framework based on open source technology Selenium WebDriver, TestNG, Java, Apache POI

#Selenium #WebDriver #Maven #TestNG #Framework #POI #Jenkins

This framework is designed to help you get started with Web testing quickly, to grow as needed, and to avoid common pitfalls. it just allows you to manipulate browser.
Who Will Cry When You Die?

Main features:
  • Provides browser automation using Selenium WebDriver
  • Page Object Model is used to design pattern to create Object Repository for web UI elements.
  •  Running test case against multiple set of test data
  • Automation Suite Configuration using Java properties file
  • TestNG.xml file which provides feature to run selective test suite
  • Screenshot capturing capability for failed test scenario (Take screenshots on demand and save on disk.)
  • Uses Apache logger for generating test execution logs
  • Build Tool : Maven
  • Programming language: Java
  • Test Data Management: data stored in Excel worksheet : Apache POI
  • Parallel Execution : Using Selenium Grid to run simultaneous test execution
  • CI Integration : Integrated with Jenkins
  • Exceptions handling : Using Java try/Catch exception handling feature
  • Reports : Custom html reports are generated and available in test-output folder

To download Framework, visit link - Download Here

Note - If any doubt/query/suggestion, pls post in forum - Testing Forum

Sunday 6 September 2015

How to Verify the limit of characters of a textbox

If you already know the char limit, then input the text which is more than the permissible limit. For example if max char limit is 30 then send a text with 31 char length and then fetch the text and count the number of character. It should be 30.

Code example is here which is written considering the limit is 30 char :- 

//Data input should be more than 30 chars
driver.findElement(By.id("textfield1")).sendKeys("Testexample1Testexample2Testexa");

//get count of string length
int actualLimit =driver.findElement(By.id("textfield1")).getText().length();

//Assertion
assertEquals(actualLimit, 30);

Saturday 5 September 2015

Selenium WebDriver : An Overview of Exception Class

List of exception classes in Selenium package (which is "org.openqa.selenium"), which we see as error on daily basis.
  1. ConnectionClosedException
  2. ErrorHandler.UnknownServerException
  3. ImeActivationFailedException
  4. ImeNotAvailableException
  5. InvalidCookieDomainException
  6. InvalidCoordinatesException
  7. InvalidElementStateException
  8. JsonException
  9. MoveTargetOutOfBoundsException
  10. NotFoundException 
  11. ScreenshotException
  12. SessionNotCreatedException 
  13. SessionNotFoundException
  14. StaleElementReferenceException
  15. TimeoutException
  16. UnableToCreateProfileException 
  17. UnableToSetCookieException
  18. UnexpectedTagNameException
  19. UnhandledAlertException 
  20. UnreachableBrowserException
  21. UnsupportedCommandException
  22. WindowsRegistryException