Tuesday, 30 January 2018

To Validate a Home Page Tittle Using Selenium Tool

WebDriver f=new FirefoxDriver();
f.manage().window().maximize();
f.get("http://newtours.demoaut.com/");
String at=f.getTitle(); //using the gettitle method get the title from the page and store in string variable
System.out.println(at);
String et=”Welcome: Mercury Tours”;
if(at.contentequals(et))  //using if condition and check the expected and actual title
{
System.out.println(“pass”);
}
else
System.out.println(“false”);


Monday, 29 January 2018

How To Test a DropDown Box in Selenium Tool

How To Test a DropDown Box

 //Find the element(Drop Down) and Stored in WebElement
WebElement c=f.findElement(By.id("")); 

// Using Select class and now store the Webelement in Select class
Select h=new Select(c); 
 //Using Select by Index method select the option,index start from 0

Note:When less no of Options in Dropdown go with Select by index. 

 h.selectByIndex(3); 

or

Note:When more no of Options in Dropdown go with Select by VisibleText.

h.selectByVisibleText("India"); 

or

Note:When test calendar dropdown or output values are number in the time use 
Select by value.

h.selectByValue("1987"); 



WebElement c=f.findElement(By.id("q3"));
Select h=new Select(c);
//h.selectByIndex(3);
//h.selectByVisibleText("Third Option");
 //h.selectByValue("1987");

To Test a Check box in Different Scenarios in selenium Tool

//Checkbox 

Suppose there is a single check box in the form to find the Element a Write a below code

f.findElement(By.name("")).click(); 

Suppose more no of check box in the page,we have to short the code.

First collect all the Elements(checkbox) and find it have same element name,it is same write the below code to test the checkbox. 

Example Site



 //To collect all the Elements and Save in the WebElement
WebElement s=f.findElement(By.xpath(""));
for(int i=0;i<=2;i++) //using for loop and put the conditions for how many checkbox are there
{
s.click(); //When loop increment it select the checkbox as one by one.
System.out.println(s.isSelected());


To Select and Deselect the Checkbox 

//To collect all the Elements and Save in the WebElement
WebElement s=f.findElement(By.xpath("")); 

for(int i=0;i<=2;i++) //using for loop and put the conditions for how many checkbox are there
{
s.click(); //When loop increment it select the checkbox as one by one.
s.click(); //When loop increment it Deselect the checkbox as one by one.
System.out.println(s.isSelected());






How To Test a Login Page in Selenium Tool

How To Test a Login Page

In the Topic We Discuss about how to test the Login page(Text box and Button)
 


Login Program.

//Header Files

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver; 


public class login {//Class Name is Login
public static void main(String[] args) {   // Main Method

//Object Creation 
WebDriver f=new FirefoxDriver(); 

//To Maximize the Window,some time the Browser Window it open as Minimize,we want to maximize the Window to write the below code
f.manage().window().maximize();
 //In the get Function mention the URL
 
f.get("URL");

f.findElement(By.id("")).sendKeys(""); //Inside of the SendKeys pass the input to the element
f.findElement(By.id("")).sendKeys("");
f.findElement(By.name("")).click();  // To test the button or link use click operation.
}


Refer the Image how inspect the Element and find the locators

After Inspect the Inspect the Element

Find The Locators
  • id
  • name
  • xpath
  • value
  • classname
  • linktext
  • partiallinktext
  • tagName



Automation testing-Selenium Requirements

Selenium Requirements

1)Language---->Java

Install JDK and JRE

2)Tool ---->Eclipse

In the Eclipse Directly write the java program it supported by try to selenium program it does not supported why?

For Example:
 you want to get a output 2+2=4 in c program,for that we use basic header files
include<stdio.h>
include<conio.h>

in the same c program yo want to get a output in graphical representation(like as circle,rectangle)

we use include<graphics.h>

like that in Eclipse libraries it contain only java related header files,classes,methods.

When add the Additional jar file into Eclipse libraries then only the code it supported in the tool.

3)Jar-->java archieve file-->Selenium Server standalone-3.8.1.jar

TO download the jar and add in to Eclipse library,now in the library it contains selenium related header files,classes,methods.

4)Browser's--->To Run the result in any Browser's.(Mozila Firefox,Chrome,IE etc.)


Selenium Introduction

Selenium Overview:

What is Selenium?

It is a
Automated Testing Tool.

It is used to test the Web and Mobile Based Application.

It is a Not a Tool,It called as IDE(Integrated Development Environment).

Selenium is Open Source Tool-It Supports all the Environment

Selenium is a Platform Independent.

Selenium It have four components: 

  •     Selenium Integrated Development Environment (IDE)
  •     Selenium Remote Control (RC)
  •     SeleniumWebDriver
  •     Selenium Grid.

 Selenium IDE:

  • It is a Simplest Framework
  • It Support only Firefox plug in

Advantage:

  • Easy to Install
  • No Programming Language
  • No Decision Making and Looping statements

DisAdvantage:

  • It support only in Firefox
  • Execution is slow compare to RC and WebDriver
  • No Support for Error Handling and Database Testing.
Selenium Remote Control (RC)

It is a First Flagship Framework,in that RC Written the Program(Varoius language) and Test the application.

It support various language-Java,C#,Python,Perl,Ruby.

Advantage:
  • It support Programming Language.(Desicion making and looping statements).
  • It support Data Driven testing
  • It Support Cross Browser Testing.
  • Faster Execution compare to IDE.
DisAdvantage:

  •  Installation is more complicated Compare to IDE
  •  Must have programming language
  •  With the help of Server to run the browser Directly.
  •  Slower Execution compare to Webdriver.
 SeleniumGrid

  • It support Parallel Testing-To Run the Browser in Different machine as simultaneously
  • Utilizes Hub and Node Concepts.
  •  Here the sub act as central source of Selenium commands to each node connected it.

Selenium WebDriver

What are the Drawbacks are facing in the Previous components it overcome in 'WebDriver'

  • Simpler Installation
  • Directly connect to the Browser,Without help of any Server.
  • It support Data Driven Testing
  • To Run the Browser's simultaneously in the same Machine.
  • It support parallel Testing
  • There is some Additional Frameworks
  • a)TestNG
  • It support Database Testing
  • It support Types of Framework
  • a)data driven framework
  • b)keyword Driven Framework
  • c)Hybrid Driven framework.
 





Software Testing SDLC Models

1)Waterfall Model

  • It is a linear sequential process.
  • It is a step by step process
  • Here one phase completed then it move next phase
  • In this model after complete the development then only start the testing.





Advantage:

  • It is a Easy Model
  • It support only small projects
  • Previous phase of the output is the next phase of the input.
  • Each phase has specific deliverables.

DisAdvantage:
  • It not support for long projects.
  • No software developed using this model
  • It is difficult to go back of previous phase.
  • In between any changes in the phase,entierly change the previous phases also.

2)Prototype Model:
  • Using Prototype model,understand the requirements and built a prototype
  • before coding and desing proceed.
  • It developed based on known requirements.
  • using the prototype client get an actual feel of the system.




Advantage:

  • users are actively involved in the Development
  • Errors can be detected in early stage
  • Quicker feedback available and find better solutions also
  • Missing functionality and difficult functions are easily identified.

DisAdvantage:

  • If the user is not statisfied with developed prototype,then a new prototype is
  • developed.
  • So it take more time consuming and expensive.
  • prototype model can lead to the false expectations.

3)Sprial Model

It is similar to incremental model.
There is four phases a)Planning,Risk Analysis,Engineering and Evaluation.

a)planning phase
Requirements are gathered during the planning phase BRs and SRs
b)Risk Analysis
in the phase to identify the risk and alternate solutions.
c)Engineering
In this phase s/w is developed and do testing
d)Evaluation
This phase allows the customer to evaluate the output of project








Advantage:

  • High Amount of Risk
  • Good for large and critical projects
  • Additional functionality can be added at later also

DisAdvantage:

  • can be a costly model to use
  • Doesn't work for smaller projects
  • projects success is highly Dependent on risk analysis.

4)Agile Model:

  • Agile Model is a Incremental Model
  • To Develop the Model as rapid cycles
  • In the Each release tested the model and ensure the software qulaity.




Advantage:

  • There is continuous Delivery in the Developing software
  • Daily coperation between bussiness peole and developers
  • Even late changes are also Welcomed

Disadvantage:

  • It take more time in Desinging and Documentation
  • Only Seniors prograamers are capable of taking the kind of decisions.

Saturday, 20 January 2018

Bascis of Software Testing Course - Day 1

Define Software?

Software is a collection of programs,algorithms and procedure and is used to perform some specific task.

Types of Software:

  • System Software--->Eg:OS--->It is a Interaction or Intermediate between both software and Hardware
  • Application Software-->Eg:Ms package,Adobe,Media Players,Skype,Teamviewer
  • Programming Software--->Which helps to develop the new software--->Eg:Eclipse,Visual studio,Turbo C ,Python IDE

Types of Application:

Window Application or Desktop or Standalone:Eg:-->Refer application software

Dont Tell--->Without Internet and it support only windows os only

Web Based Application

Eg:.com,.in.co all websites

use of internet and help of browsers to run the application

Mobile Based Appl

Classify in to two types

  • Native-->App support only in Mobile or Andirod OS
  • Hybrid-->App Support in both (window or Web) and (Andirod and IOS)

Define Software Testing

To check the correctness,completeness,consistences and quality of the given software.

Software testing is an activity to check whether the actual results match the expected results and to ensure that the software system is Defect free.

Actual Results--->after testing the software,get the results by tester.

Expected Result--->before Development Client give a Requirement to get a result like that.

Eg  : To Test the Username with 4-8 char

Scenarios:
  • Valid Input--->Accept--->pass
  • Invalid Input--->Not Accept--->Pass
  • Valid Input---->Not accept-->Fail
  • Invalid Input---->Accept--->Fail.