Software Testing Tools Manual
Software Testing Tools Manual
SOFTWARE TESTING
TOOLS
Published by
This book may not be duplicated in any way without the express written consent of
the publisher, except in the form of brief excerpts or quotations for the purpose of
review. The information contained herein is for the personal use of the reader and
may not be incorporated in any commercial programs, other books, database, or
any kind of software without written consent of the publisher. Making copies of
this book or any portion thereof for any purpose other than your own is a violation
of copyright laws.
Trademarks: All brand names and product names used in this book are
trademarks, registered trademarks, or trade names of their respective holders.
ISBN 978-81-951822-2-0
This book is printed in 70 gsm papers.
Printed in India by Mahasagar Technologies.
Coimbatore Institute of Information Technology,
#156, 3rd Floor, Kalidas Road, Ramnagar,
Coimbatore – 641009, Tamil Nadu, India.
Phone: 0422 - 4377821
www.ciitresearch.org
ii
Authors
Mrs. K. Geethalakshmi Mrs. L. Sheeba
Mrs. S. Mohanapriya Mrs. G. Sangeetha
Mrs. M. Selvanayaki Mrs. S. Kavitha
Mrs. T. S. Anushya Devi Mrs. J. Angel
Mrs. T. Saranya Mrs. P. R. Asha
iii
Notes
**********
iv
C. Surendar MCA.,
Technical Head -Development,
AAKKAM Industrial Training and Research
Institute
Coimbatore, Tamil Nadu.
India.
v
Notes
**********
vi
SETUP SELENIUM ENVIRONMENTS
1. ENVIRONMENTS
JDK 1.8
ECLIPSE NEON
SELENIUM STANDALONE SERVER
CHROME DRIVER
vii
STEP 2: To download ECLIPSE NEON
https://www.eclipse.org/neon/
viii
STEP 3: To download SELENIUM STANDALONE SERVER
https://www.selenium.dev/downloads/
ix
https://chromedriver.chromium.org/downloads
x
Download ChromeDriver as per the Chrome version
https://chromedriver.storage.googleapis.com/index.html?path=85.
0.4183.87/
xi
Notes
**********
xii
Software Testing Tools
Syllabus:
xiii
Notes
**********
xiv
List of Experiments
S. No Programs Page No
xv
Notes
**********
xvi
Software Testing Tools
Department of BCA 1
Software Testing Tools
Department of BCA 2
Software Testing Tools
package Mytest;
import java.io.File;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.google.common.collect.Table.Cell;
Department of BCA 3
Software Testing Tools
XSSFRow row=sh.getRow(0);
int noofrows= row.getLastCellNum();
System.out.println("Total No Of Rows in the Sheet :" +noofrows);
System.out.println(sh.getRow(1).getCell(0).getStringCellValue());
System.out.println(sh.getRow(1).getCell(1).getStringCellValue());
System.out.println(sh.getRow(2).getCell(0).getStringCellValue());
System.out.println(sh.getRow(2).getCell(1).getStringCellValue());
}
}
Department of BCA 4
Software Testing Tools
Output:
Department of BCA 5
Software Testing Tools
EXCEL DATA
Department of BCA 6
Software Testing Tools
Department of BCA 7
Software Testing Tools
Department of BCA 8
Software Testing Tools
package Mytest;
import java.util.Scanner;
public class percentageabove60 {
public static void main(String[] args) {
Scanner SC=new Scanner(System.in);
System.out.println("Enter the number of students");
int n = SC.nextInt();
Department of BCA 9
Software Testing Tools
}
}
Output:
Enter the number of students: 5
Student Detail 0
Enter Name: Abi
Enter Percentage: 55
Student Detail 1
Enter Name: Banu
Enter Percentage: 61
Department of BCA 10
Software Testing Tools
Student Detail 2
Enter Name: Cathy
Enter Percentage: 65
Student Detail 3
Enter Name: Deepi
Enter Percentage: 58
Student Detail 4
Enter Name: Elsi
Enter Percentage: 60
Student Banu having percentage 61 has above 60 Percentage
Student Cathy having percentage 65 has above 60 Percentage
Department of BCA 11
Software Testing Tools
Notes
**********
Department of BCA 12
Software Testing Tools
package Mytest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver",
"C:\\Users \\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");
Department of BCA 13
Software Testing Tools
driver.findElement(By.name("userName")).sendKeys("tutorial")
;
driver.findElement(By.name("password")).sendKeys("tutorial");
Thread.sleep(1000);
driver.findElement(By.xpath("/html/body/div/table/tbo
dy/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/
table/tbody/tr[2]/td[3]/form/table/tbody/tr[4]/td/tabl
e/tbody/tr[4]/td[2]/div/input")).click();
}
}
Output:
Department of BCA 14
Software Testing Tools
Department of BCA 15
Software Testing Tools
Notes
**********
Department of BCA 16
Software Testing Tools
package Mytest;
import java.awt.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
Department of BCA 17
Software Testing Tools
driver.get("C:\\Users\\Malar\\workspace\\TestingExercise\\comb
ocount.html");
//Get all the option from dropdown list and assign into List
java.util.List<WebElement> listOptionDropdown =
selectDropdown.getOptions();
Combocount.html
<html>
<body>
Department of BCA 18
Software Testing Tools
Department of BCA 19
Software Testing Tools
Department of BCA 20
Software Testing Tools
package Mytest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class testhtml {
Department of BCA 21
Software Testing Tools
driver.get("C:\\Users\\Malar\\Desktop\\Testing\\login.htm
l");
}
}
Login.html
<html>
<head>
<title>Login </title>
</head>
<body>
<h4><center>Myklass Login Page</center> </h4> </br>
<p5>Email address: </p5>
<input type="text" Email address=""> </br> </br>
<p6>Password: </p6>
<input type="password" > </br>
<p> <font color="black"> <a href="#">Login </a></p> </font>
</body>
</html>
Department of BCA 22
Software Testing Tools
Output:
Department of BCA 23
Software Testing Tools
Notes
**********
Department of BCA 24
Software Testing Tools
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import jxl.CellView;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.format.UnderlineStyle;
Department of BCA 25
Software Testing Tools
import jxl.write.Formula;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class student_excel_write {
private WritableCellFormat timesBoldUnderline;
private WritableCellFormat times;
private String inputFile;
public void setOutputFile(String inputFile) {
this.inputFile = inputFile;
}
public void write() throws IOException, WriteException {
File file = new File(inputFile);
WorkbookSettings wbSettings = new WorkbookSettings();
wbSettings.setLocale(new Locale("en", "EN"));
WritableWorkbook workbook = Workbook.createWorkbook(file,
wbSettings);
workbook.createSheet("Report", 0);
WritableSheet excelSheet = workbook.getSheet(0);
createLabel(excelSheet);
createContent(excelSheet);
workbook.write();
workbook.close();
}
private void createLabel(WritableSheet sheet)
throws WriteException {
// Lets create a times font
WritableFont times10pt = new WritableFont(WritableFont.TIMES,
10);
Department of BCA 26
Software Testing Tools
Department of BCA 27
Software Testing Tools
}
private void addCaption(WritableSheet sheet, int column, int row,
String s)
throws RowsExceededException, WriteException {
Label label;
label = new Label(column, row, s, timesBoldUnderline);
sheet.addCell(label);
}
private void addNumber(WritableSheet sheet, int column, int row,
Integer integer) throws WriteException, RowsExceededException {
Number number;
number = new Number(column, row, integer, times);
sheet.addCell(number);
}
private void addLabel(WritableSheet sheet, int column, int row,
String s)
throws WriteException, RowsExceededException {
Label label;
label = new Label(column, row, s, times);
sheet.addCell(label);
}
public static void main(String[] args) throws WriteException,
IOException {
student_excel_write test = new student_excel_write();
test.setOutputFile("C:/Users/Savitha/Desktop/Student.xls");
test.write();
System.out.println("Please check the result file under
C:/Users/Savithar/Desktop/Student.xls ");
}
}
Department of BCA 28
Software Testing Tools
OUTPUT:
Department of BCA 29
Software Testing Tools
Notes
**********
Department of BCA 30
Software Testing Tools
package Mytest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
Department of BCA 31
Software Testing Tools
System.setProperty("webdriver.chrome.driver", "C:\\Users
\\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");
driver.findElement(By.name("txt1")).sendKeys("200".toString())
;
driver.findElement(By.name("txt2")).sendKeys("100".toString())
;
driver.findElement(By.name("txt3")).sendKeys(
String.valueOf(total));
}
}
prgsum.html file
<html>
<head>
<title>Login </title>
</head>
<body>
Department of BCA 32
Software Testing Tools
Output:
Department of BCA 33
Software Testing Tools
Notes
**********
Department of BCA 34
Software Testing Tools
Arithmetic opearation.html
<html>
<head>
<title>Arithmetic operations</title>
</head>
<script type="text/javascript">
function Addition()
{
x=parseFloat(calc.value1.value);
y=parseFloat(calc.value2.value);
z=(x+y);
alert("The Addition result is"+z);
calc.value3.value=z
}
function Subtraction()
Department of BCA 35
Software Testing Tools
{
var x,y,z;
x=calc.value1.value;
y=calc.value2.value;
z=x-y;
alert("The subtraction result is "+z);
calc.value3.value=z
}
function Multiplication()
{
var x,y,z;
x=calc.value1.value;
y=calc.value2.value;
z=x*y;
alert("The Multiplication result is "+z);
calc.value3.value=z
}
function Division()
{
var x,y,z;
x=calc.value1.value;
y=calc.value2.value;
z=x/y;
alert("The subtraction result is "+z);
calc.value3.value=z
}
</script>
</head>
<body>
<form name="calc">
<h1>Arithmetic operations</h1>
Enter first Numeric Value : <input type="number" id="value1">
</br>
Department of BCA 36
Software Testing Tools
OUTPUT
Test case 1
Department of BCA 37
Software Testing Tools
Test case 2
Test case 3
Test case 4
Department of BCA 38