Tuesday 29 October 2013

DataTypes in Java-Selenium

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.

Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals, or characters in these variables.

There are two data types available in Java:

Primitive Data Types

Reference/Object Data Types

There are eight primitive data types supported by Java. Primitive data types are predefined by the language and named by a keyword. Let us now look into detail about the eight primitive data types.

Byte data type is an 8-bit signed two's complement integer.

Minimum value is -128 (-2^7)

Maximum value is 127 (inclusive)(2^7 -1)

Default value is 0

Byte data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.

Example: byte a = 100 , byte b = -50

Short data type is a 16-bit signed two's complement integer.

Minimum value is -32,768 (-2^15)

Maximum value is 32,767 (inclusive) (2^15 -1)

Short data type can also be used to save memory as byte data type. A short is 2 times smaller than an int

Default value is 0.

Example: short s = 10000, short r = -20000

Int data type is a 32-bit signed two's complement integer.

Minimum value is - 2,147,483,648.(-2^31)

Maximum value is 2,147,483,647(inclusive).(2^31 -1)

Int is generally used as the default data type for integral values unless there is a concern about memory.

The default value is 0.

Example: int a = 100000, int b = -200000

Long data type is a 64-bit signed two's complement integer.

Minimum value is -9,223,372,036,854,775,808.(-2^63)

Maximum value is 9,223,372,036,854,775,807 (inclusive). (2^63 -1)

This type is used when a wider range than int is needed.

Default value is 0L.

Example: long a = 100000L, int b = -200000L

float:
Float data type is a single-precision 32-bit IEEE 754 floating point.

Float is mainly used to save memory in large arrays of floating point numbers.

Default value is 0.0f.

Float data type is never used for precise values such as currency.

Example: float f1 = 234.5f

double data type is a double-precision 64-bit IEEE 754 floating point.

This data type is generally used as the default data type for decimal values, generally the default choice.

Double data type should never be used for precise values such as currency.

Default value is 0.0d.

Example: double d1 = 123.4

boolean:
boolean data type represents one bit of information.

There are only two possible values: true and false.

This data type is used for simple flags that track true/false conditions.

Default value is false.

Example: boolean one = true

char data type is a single 16-bit Unicode character.

Minimum value is '\u0000' (or 0).

Maximum value is '\uffff' (or 65,535 inclusive).

Char data type is used to store any character.

Example: char letterA ='A'

Reference Data Types:
Reference variables are created using defined constructors of the classes. They are used to access objects. These variables are declared to be of a specific type that cannot be changed. For example, Employee, Puppy etc.

Class objects, and various type of array variables come under reference data type.

Default value of any reference variable is null.

A reference variable can be used to refer to any object of the declared type or any compatible type.

Example: Animal animal = new Animal("giraffe");

Java Literals:
A literal is a source code representation of a fixed value. They are represented directly in the code without any computation.

Literals can be assigned to any primitive type variable. For example:

byte a = 68;
char a = 'A'
byte, int, long, and short can be expressed in decimal(base 10), hexadecimal(base 16) or octal(base 8) number systems as well.

Prefix 0 is used to indicate octal and prefix 0x indicates hexadecimal when using these number systems for literals. For example:

int decimal = 100;
int octal = 0144;
int hexa =  0x64;
String literals in Java are specified like they are in most other languages by enclosing a sequence of characters between a pair of double quotes. Examples of string literals are:

"Hello World"
"two\nlines"
"\"This is in quotes\""
String and char types of literals can contain any Unicode characters. For example:

char a = '\u0001';
String a = "\u0001";
Java language supports few special escape sequences for String and char literals as well. They are:

Notation Character represented
\n            Newline (0x0a)
\r             Carriage return (0x0d)
\f             Formfeed (0x0c)
\b            Backspace (0x08)
\s             Space (0x20)
\t             tab
\"             Double quote
\'             Single quote
\\             backslash
\ddd       Octal character (ddd)
\uxxxx    Hexadecimal UNICODE charac



Saturday 26 October 2013

Online training on selenium@MindQ Systems



SELENIUM TRAINING
Mindq Systems provides training on SELENIUM BASE/INTERMEDIATE/ADVANCE
classes will be conducted by real time trainer's
WE PROVIDES WEEKEND,WEEKDAYS,CLASSROOM, ONLINE,FASTTRACK,REGULAR BATCHES.
Course Objective
On Completion of Selenium –Java course the participants will be able to
Understand Oops /java concepts
Understand Selenium IDE,RC
Understand Selenium WebDriver tool in depth, it’s features & components
Building a new Test Framework by using Web Driver, Test NG and Maven
Suggested Audience:
Basic knowledge of any programming language. Core java knowledge will be added advantage
Duration: 30 Hrs
SOFTWARE TRAINING LABS will teach you the Selenium applications with real time scenarios. Experienced and corporate trainers will share their knowledge during the classes. Corporate trainers will have more than 8 years of experience.
Syllabus has been structured to provide the complete learning process of Selenium. Practical Test and periodic exercises will be provided to enrich the programming skills. You can able to provide the solution for a real world scenario in end of the training with your programming skill.
WE ARE PROVIDING THE SELENIUM
BASE
INTERMEDIATE
ADVANCE SELENIUM
JAVA FOR INTERMEDIATE AND ADVANCE SELENIUM
FOR COURSE DETAILS AND SYLLABUS
Please Call Us: +91 9502991277
Hyderabad
8-3-214/7, 1st Floor,
Srinivasa Nagar Colony(W)
Above HDFC Bank, S.R.Nagar,
Hyderabad-500038
Telephone: 040-66664291/92
Email: info@mindqsystems.com

Thursday 24 October 2013

Selenium Online Training @ MindQ

MindQ are pioners in offering real time industrail experts hands Testing tools online training.
along with Real Time Project senarios. All the sessions are completely PRACTICAL.

- Learn selenium from experts having more that 6 years of experience in selenium projects
- Hands on goal oriented training with projects
- 75 hours of videos on selenium
- Interview preparation/questions on selenium
- All the types of frameworks are also covered in the training.(Datadriven, hybrid, Page object model, Keyword driven frameworks)
All the components in selenium will be covered. Components like:
1) Selenium IDE
2) Webdriver
3) Selenium RC
4) Grid
5) Selenium Database testing
6) Flash Testing
7) SVN
8) Maven
9) Applet testing
10) Junit
11)Test ng
12) Hybrid framework
13) Data driven framework
14) Page object model
Java is also taught during the training. We offer the best selenium training in the market.

About the tool:
- Selenium is a browser automation tool
- It works only on browsers and cannot automate desktop based applications
- Selenium IDE only tests the applications in Mozilla firefox
- WebDriver and Selenium RC can be used to test the application in multiple browsers
- Webdriver is also known as selenium 2.0
- RC is also known as 1.0
- Selenium Grid is used to test applications parallely in browsers
- Junit and testng are frameworks which can be used to implement selenium tests. Reports are also generated from these frameworks
- Selenium tool can be implemented in various programming languages
- Its more famous with java language. 70% of the industry uses java with selenium

* Resume preparation and Interview assistance will be provided.

For any further details please contact +91-9502991277 or
visit www.mindqonline.com
Please mail your queries to online@mindqsystems.com


Installing Eclipse-selenium training



we will use the Eclipse software for writing, compiling, and testing programming assignments. Although you can use Eclipse at school (see Launching Eclipse on Solaris) we highly recommend you install the Eclipse environment on your computer. Accessing Eclipse remotely through the campus network is theoretically possible, but extremely slow.

The Eclipse installation process has four main steps:

Install the Java 5.0 software.
Install the Eclipse 3.1 software (It does not includes Java 5.0).
Launch Eclipse.
Install a set of plugins designed especifically for courses taught in the Dept of Computer Science.
The files you will need to download are quite large so it is necessary you have a fast internet connection. For people that have slow connections (e.g., telephone modem), we can provide a limited number of CD's with the required software or you could copy the files to a CD from one of the wam labs on campus.   Please contact your instructor or teaching assistant for more details.

Next we describe the installation process for Windows and for Mac OS X.  If you have a system different from Windows or Mac OS X (e.g., linux) see the "Software Source" section below.  Feel free to skip the section that does not apply to your system.

Installation Process for Windows

Install Java 5.0
Download the file jdk-1_5_0_04-windows-i586-p.exe.
Double-click on the previously downloaded file and following the installation instructions.
Install Eclipse 3.1 software (It does not includes Java 5.0)
Download the file eclipse-SDK-3.1-win32.zip.
Once you have unzipped the previously downloaded file, you will see a folder named eclipse.  In that folder you will find the eclipse application (a big blue dot).  We recommend you create a shortcut on the desktop to simplify the launching of eclipse.  Notice that unlike Java, Eclipse does not have an installation process.  Once you have unzipped the file you are done.
Launch Eclipse
Follow the steps in launching Eclipse.
Installing the plugins
Launch eclipse if you have done so.
Follow the instructions provided on the web site http://www.cs.umd.edu/~pugh/eclipse.  After installing the new plugins, you will need to relaunch Eclipse.  Keep in mind that you will not be able to submit projects if you don't complete the installation of these plugins.
Installation Process for Mac OS X

Install Java 5.0
If you have a Mac and are planning to use Java 5.0 you must update your OS to Tiger.  As a student of the University you can obtain a copy of this software for $20.00.  Visit the web site Mac OS X v.10.4 for further information.
Follow the instructions on the web page (J2SE) 5.0 Release 1 for Tiger
Install Eclipse 3.1 software (It does not includes Java 5.0)
Download the file eclipse-SDK-3.1-macosx-carbon.tar
After double-clicking on the previously downloaded file, you will see a folder named eclipse.  In that folder you will find the eclipse application (a big blue dot).  We recommend you create a shortcut on the desktop to simplify the launching of eclipse.  Notice that unlike Java, Eclipse does not have an installation process.  Once you have untarred the file you are done.
Launch Eclipse
Follow the steps in launching Eclipse.
Installing the plugins
Launch eclipse if you have done so.
After installing the new plugins, you will need to relaunch Eclipse.  Keep in mind that you will not be able to submit projects if you don't complete the installation of these plugins.



Tuesday 22 October 2013

TARGET ELEMENTS USING CSS SELECTORS-Selenium


I strongly recommend CSS selectors as the locating strategy of choice.

CSS selectors are considerably faster than XPath and can find the most complicated objects in any HTML document.

Additional documentation on CSS selectors is available on the link below

There are several CSS selectors, but I am going to introduce you to a few of them as we gradually build our case to more complex examples.

(a) Element Selectors

(b) ID Selectors

(c) Class Selectors

<html>
    <head>
        <title>CSS Selectors</title>
    </head>
    <body>
        <h3 id="moduleHeader">Page Module Header</h3>
        <div class="primaryContainerModule">

            <h4 id="pageSub">Subtitle</h4>
        </div>
        <form id="pageForm" method="post" action="process.php">
            <input type="text" name="username" value="" />
            <input type="password" name="password" value="" />
            <input type="submit" name="submit button" value="Submit Form" />
        </form>
    </body>
</html>

Element Selectors
Element selectors use the name of the element to locate the element.

In the above document, we can target the subtitle by using the following CSS selector

css=h4

We can also target the page module by using the following css selector

css=h3

ID Selectors (CONTAINS HASH OR POUND SIGN)

ID selectors use place a hash or pound sign in front of the id value of that element

In the above document, we can target the subtitle by using the following CSS selector

css=#pageSub

We can also target the page module by using the following css selector

css=#moduleHeader

Class Selectors (CONTAINS DOTS)

Class selectors place a dot in front of the class attribute value of that element

In the above document, we can target the primary container by using the following CSS selector

css=.primaryContainerModule

Class Selectors Multiple (CONTAINS DOTS)


<input type="checkbox" class="europe asia africa" value="Continent" />

If the element has multiple classes, you can target it by specifying the classes concatenated using dots

css=.europe.asia.africa

COMBINING SELECTORS

Sometimes when a particular selector matches more than one element, you may need to combine selectors to clarify things

Here is some of that syntax

css=div#party

In the above example, we are combining the div element selector with the party id selector

css=div.party

In the above example, we are combining the div element selector with the party class selector

SELECTING ELEMENTS WITH CERTAIN ATTRIBUTES
We can also select certain elements that have certain attribute values.

In the form above, we can target the submit button by using the following syntax.

css=input[type=submit]

SELECTING ELEMENTS USING MULTIPLE ATTRIBUTES

<input type="text" class="europe asia africa" value="Continent" />
<input type="text" class="europe asia africa" value="Company" />
<input type="checkbox" class="europe asia africa" value="Continent" />
<input type="checkbox" class="europe asia africa" value="Company" />
<input type="hidden" class="europe asia africa" value="Continent" />

In the above example, if we wanted to target the checkbox with value Continent, we can use the following selector:

css=input[type=checkbox][value=Continent]

DESCENDANT SELECTORS

This type of selectors are using to access elements located with other elements when the locator can hit multiple matches

A space is needed between each selector leading to the target from the ancestor to the descendant going from left to right

In the HTML source below, we can use the descendant selectors to distinguish between the Page Module Header and the Subtitle for and automation engineer.

If we want to target the h3 element for the subtitle for an automation engineer, we cannot use css=h3 because selenium will stop the search once it comes across the Page Module Header h3 element.

Selenium will always stop the search as soon as it finds the first match. So we need to be more specific by using descendant selectors.

Using the following CSS selector will allow us to distinguish between the Page Module Header and the Subtitle for an Automation Engineer.

css=div.primaryModuleContainer div.automationEngineer h3

<html>
    <head>
        <title>CSS Selectors</title>
    </head>
    <body>

        <div>
            <h3>Page Module Header</h3>
        </div>

        <div class="primaryContainerModule">

            <video width="320" height="240" controls="controls"></video>

            <div class="softwareEngineer">
                <h3>Subtitle</h3>
            </div>

            <div class="qualityAssuranceEngineer">
                <h3>Subtitle</h3>
            </div>

            <div class="automationEngineer">
                <h3>Subtitle</h3>
            </div>

            <div>
                <video width="320" height="240" controls="controls"></video>
            <div>

        </div>
    </body>
</html>