How to fix Java language level error in Intellij?

 java: strings in switch are not supported in -source 1.5
  (use -source 7 or higher to enable strings in switch)

java string source error

Why this error, as we are trying to access feature of java(in our case switch statements) using java 1.5 which is actually supported in higher version of java (7 in our case).

IDE used is Intellij.

File > Project Structure >Project > Project language level
Change this to 1.7 or higher
java language level error in selenium
File > Project Structure > Modules > Select the module > language level
intellij change language level

File > settings > Java Compiler > change to latest compiler
java compiler settings intellij

Rerun the project, hope it will work fine :)

Learn Selenium

Introduction to Appium(Mobile Testing)

Mobiles are everywhere; our day starts with an alarm ringing on phone and ends with WhatsApp or buffering some social media portal. Do we ever think that we are surrounded by mobile applications everywhere, from checking weather, transit, shopping, video chats or banking and so on?

Each day hundreds of new mobile apps are coming into market, its good news for TESTERS, as we can imagine the scope of mobile testing in the future. It’s skyrocketing.
mobile testing

Based on the reader’s feedback and interest we are starting with our Mobile Automation Testing tutorials using the most popular tool – APPIUM.

What is Appium?
Appium is an open source tool for automation testing of mobile applications. It is a bridge or we can say in simple terms it is a mediator between PC and mobile.
It supports three types of mobile applications i.e. native, web application and hybrid.

Native Applications are developed for use on a particular device or platform like for iPhone(IOS)  or Nexus(Android).It is installed directly on a mobile device and developers create a separate app version for each mobile device.
Mobile Web Application are called mobile website and can be accessed through browser by hitting the URL.Like opening Quora website in iPhone or Nexus.
Hybrid Application combines elements of both native and web applications.  It uses the concept of wrapper like using ionic framework  around the webview, which is bundled to create hybrid app with native wrapper. Like mobile native apps, you can find and download mobile hybrid apps using the Google Play Store or the Apple’s App Store. Similar to mobile web app, a mobile hybrid app would look alike to a mobile website that can be accessed by hitting an URL in the web browser.

Supported platforms:-
  • iOS
  • Android
  • FirefoxOS

It all started in 2011 when Dan Cuellar as a test manager was finding an easy work around for testing IOS applications. Later when he presented the lighting talks at selenium conference 2012, Jason Huggins (co-creator Selenium/founder of sauce labs) saw his work. Finally code was published on GitHub and in 2013 Sauce labs created a full fledge team to enhance the features of Appium. Appium 1.0 was released in May 2014 since than its popularity as open source mobile testing tool is growing.

Name Appium came from Selenium for Apps as suggested by Jason Huggins.

Architecture of Appium:-
Appium is an 'HTTP Server'(writtern in Node.js) that exposes a REST API. When their is request from client, server receives the commands, executes those commands on a mobile device, and responds with an HTTP response representing the result of the command execution. Thus server drives iOS and Android session using Webdriver JSON wire protocol. 

APPIUM Architecture

How to do the Appium Setup?

How to connect Robot Framework to various databases?

The mind, once stretched by a new idea, never regains its original dimensions

Robot framework connection to Database


Basic flow of working with database with any automation tool is same the way we will do it manually,
create connection to database -> send queries to db -> consume the results.

For automation tools like UFT we can used createobject methods without installing any drivers(API). But for most of the open source tools (libraries/frameworks) like selenium or robot framework we need drivers to create connectivity with database(db) for executing our queries.

All the db's have their corresponding drivers.In our working example we have taken SQL server as our db.

1.Install Database library

2. Install SQL drivers.

Working with My SQL:-
We need the database library same incase of SQL example shown.
Install MySQL Drivers

Basics of HashTable in Java

We started with Array's in Java and moved to ArrayList, today we would be focusing on Hash Table's in Java. Further we would be comparing Hast Table with Hash Map.

HashTable in Java example
HashTable for happy living 

What is a Hash Table?
A Hashtable is similar to ArrayList but here we don’t directly use Index to access elements but instead use Key to store a given value. It works on the principle of Key-Value pairs (like a dictionary inVbscript.).Such that each value is accessed by a corresponding Key.

In simple terms, Hashtables work by mapping a key to a value.

Any non-null object can be used as a key or as a value.

Principle behind HashTable:-
A hash table stores data inthe form of Key-value pairs.It is made up of two parts: an array (the actual table where the data to be searched is stored called as Buckets) and a mapping function, known as a hash function. The hash function is most important part, as it is  responsible for mapping from the given Key to an index for storing Key-value pairs in the Array. 

In other words, the hash function provides a way for assigning numbers to the input data such that the data can then be stored at the array index corresponding to the assigned number.
HashTable Example Java
Hash function assigns an hash code(index) based on two factors the key and the range of the bucket(thus it calculates index = Hash function(Key, Range of Array)).

Data is placed into a hashtable through the put method, and can be accessed using the get method.

When we pass Key and Value object  to put(key, value) method it calls the   hash Function on Key object and applies returned hash code into its own 
hashing function to find a bucket location for storing Entry object, vital thing is that, in Hashtable Java stores both key and value object in Bucket.

A hash function doesn't guarantee that every input will map to a different output. There is always the chance that two inputs will hash to the same output. Meaning more than one key,value pairs can be indexed to the same array location.This indicates that both elements should be inserted at the same place in the array, and this is impossible. This phenomenon is known as a collision.It can be avoided by various techniques like chaining,linked list. we are not discussing Collision in HastTable in this post.

It can be created using one of the following four constructors;

Creates an Empty Hash table with a default initial capacity (11) and load factor (0.75). 

Means array size is 11 and when it is 75% occupied its array size would increase automatically to accomdate new key,value pairs.

2.Hashtable(int initialCapacity)
creates a hash table that has given initial size specified by InitialCapacity

3.Hashtable(int initialCapacity, float loadFactor)
Creates a hash table that has an initial size specified by intial capacity and a loadFactor decides when to automatically increase the size of the Hashtable.

4.HashTable(Map m)
Creates an Hashtable with a Given Map m.

1.Load factor Default value is .75 , That if the Hashtable is 3/4 th full then the size of the Hashtable is increased, this is called Rehashing. We can force hashtable to expand only when it is completely full by making Load factor to 1.0 but it is not recommended as it effects performance of hashtable by increasing probability of collision (Meaning same hashcode for different keys)

2.We would get "IllegalArgumentException"- if the initial capacity is less than zero, or if the load factor is negative.

3.Duplicate and Null Key values are not allowed in Hash Table thus an Hashtables never contain items with duplicate keys.

Important Methods:-
Get:-Returns the Value for the Given Key in the HashTable, null if this HashTable contains no mapping for the key

Put: - Used for creating a Mapping between a Given Key and Value. Meaning adding Key-Value pairs to HashTable

Size: - Returns the count of keys in Hashtable

Keys: - Returns an enumeration (collection of objects) of the keys in hashtable.

Clone: - Creating a replica of HashTable

1. Using Put and Get method to create and retrieve data from a HashTable
public static void main(String args[]) {

// Creating Hashtable for example
Hashtable companies = new Hashtable();

// Java Hashtable example to put object into Hashtable
// put(key, value) is used to insert object into map
companies.put("Google", "United States");
companies.put("Nokia", "Finland");
companies.put("Sony", "Japan");

System.out.println(companies );
// Java Hashtable example to get Object from Hashtable
// get(key) method is used to retrieve Objects from Hashtable

2.Using Size method to find the size of HashTable,clone the hashtable and clear the hashTable
// How to find size of Hashtable in Java
// use hashtable.size() method to find size of hashtable in Java
System.out.println("Size of hashtable in Java: " + companies.size());

Difference between Hash Table and Hash Map?
The HashMap  is equivalent to Hashtable, except that it is non synchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesn't allow nulls).

Synchronized means only one Thread can modify a hash table at one point of time. Meaning that any thread before performing an update on a Hashtable will have to acquire a lock on the object while others will wait for lock to be released.

import java.util.Hashtable;

public class HashMapHashtableExample {
    public static void main(String[] args) { 

        Hashtable hashtableobj = new Hashtable();
        hashtableobj.put("Alive is ", "awesome");
        hashtableobj.put("Love", "yourself");
        System.out.println("Hashtable object output :"+ hashtableobj);


        HashMap hashmapobj = new HashMap();
        hashmapobj.put("Alive is ", "awesome");  
        hashmapobj.put("Love", "yourself"); 
        System.out.println("HashMap object output :"+hashmapobj);   


How to fix error and get back to https with ssl?

Our attitude toward life determines life's attitude towards us...


gem install error

Temporarily remove secure connection:

gem sources -r

gem sources

Add insecure connection

gem sources -a

gem install for SSL error

Install compass gem

install compass successfully

After installing compass do vice versa:

a) gem sources -r - to remove insecure connection

b) gem sources -a - to add secure connection

Learn More share more :)

Selenium interview Q/A Part-1

Selenium interview questions

1.What is the meaning of Page object Model pattern?

2.What is the difference between data/keyword driven frameworks?

3.Difference between TestNG and Junit?

4.Major components of OOPS?

5.What are the new features in Java - 8?

6.Key components of white box testing?

7.Meaning of headless browser?

8.What is the advantages and disadvantages of headless browser testing?

10.Explain any of the challenging scenario while working with Selenium webdriver

1.Page object model is a design pattern which separates "What we need to test" and "How we are going to test it".This provides readable, easy to maintain and reduces duplicate code. Corresponding classes are created for each page, with UI webelements properties and methods.

2.Data drives the test cases, example testing gmail login with 10 set of username.Keyword driven, english like keywords are created which defines the actions that user need to perform on application. Example open browser, login to gmail.

  • Object - entity with state and behaviour example laptop, pen
  • Class - blueprint for object, call it collections of objects with members(state) and methods(behaviour)
  • Inheritance - child(sub class) inherits from parent(super class), provides code resuablity.Class A extends Class B.
  • Polymorphism - many form of the same function Types: method overloading+ method overriding.
  • Abstraction - hiding the implementaiton details - interface or abstarct class
  • Encapsulation - objects encapsulate their state and hide it from the outside using private, protected, public and default.
5.Date/Time API improvements, default method in interface, lambda expressions, javascript engine.

6.Unit and Integration testing. Diving deep into code to perform testing.
7.Browser without having any UI. Drivers like HTMLUnit, PhantomJs
8.Advantage - Faster,platform independent.Disadvantages:-Difficult to pin point errors say on page loading, ajax calls.

API testing interview Questions-1 ?

api TESTING interview Questions

Do follow us for more updates on  Fb,G+,Twitter.

Basic API Testing interview questions:-

1.What is the meaning of HTTP protocol?

2.What are the range of methods available in HTTP?

3.What is the difference between PUT and POST method?

4.What are the different  HTTP status codes?

5.Why we use 5XX error code?

6.How we can filter the Head of the response?

7.What is the difference between UI and API testing tools?

8.How to test code coverage using API testing?

9.How we can implement reporting structure in Soap UI(Free version)

10.Range of tools that can we used to test API?


1.HTTP (Hypertext Transfer Protocol) provides a network protocol standard that Web browsers and servers use to communicate.Both SOAP and Rest API internally uses HTTP.
4. 1xx- information error, 2xx-Success, 3xx-Redirection,,4xx-Client Error(most common is page not found,401-bad request),5xx-Server Error
6.By using HEAD method :)
9.By using Groovy scripting and making our hands dirty with creating a robust framework for reporting.
10.SOAP UI(Soap,Rest), Robot Framework(Rest) , Postman(chrome plugin, mostly used by developers ), HP UFT