0% found this document useful (0 votes)
20 views55 pages

Software Testing Tools Manual

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views55 pages

Software Testing Tools Manual

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

LAB MANUAL

SOFTWARE TESTING
TOOLS

DBT STAR STATUS


Department of BCA

Published by

Coimbatore Institute of Information Technology


#156, 3rd Floor, Kalidas Road, Ramnagar,
Coimbatore – 641009, Tamil Nadu, India.
Website: www.ciitresearch.org
All Rights Reserved.
Original English Language Edition 2021 © Copyright by Coimbatore Institute of
Information Technology.

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.

This edition has been published by Coimbatore Institute of Information


Technology, Coimbatore.

Limits of Liability/Disclaimer of Warranty: The author and publisher have used


their effort in preparing this Software Testing Tools book and author makes no
representation or warranties with respect to accuracy or completeness of the
contents of this book, and specifically disclaims any implied warranties of
merchantability or fitness for any particular purpose. There are no warranties
which extend beyond the descriptions contained in this paragraph. No warranty
may be created or extended by sales representatives or written sales materials.
Neither CiiT nor author shall be liable for any loss of profit or any other
commercial damage, including but limited to special, incidental, consequential, or
other damages.

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.

The Lab Manual of Software Testing is a collection of ten


titled modules that facilitate the development of Software Testing, is
a method to check whether the actual software product matches
expected requirements and to ensure that software product is
Defect free. It involves execution of software/system components
using manual or automated tools to evaluate one or more properties
of interest. The purpose of software testing is to identify errors, gaps
or missing requirements in contrast to actual requirements.
I hope that the practical manual will also be of interest to
software testing who want to learn and practice a little more about
the tools like selenium, appium related to perform software
testing. This book is intended to ease the learning curve for new
users of software testing , Testing in Software Engineering is a
process of evaluating a software product to find whether the current
software product meets the required conditions or not. The testing
process involves evaluating the features of the software product for
requirements in terms of any missing requirements, bugs or errors,
security, reliability and performance. The book has been carefully
reviewed by the team experts and highly appreciated to fulfil the
requirement of the DBT STAR College Scheme.

v
Notes
**********

vi
SETUP SELENIUM ENVIRONMENTS

1. ENVIRONMENTS
 JDK 1.8
 ECLIPSE NEON
 SELENIUM STANDALONE SERVER
 CHROME DRIVER

STEP 1: To download JDK 1.8


https://www.oracle.com/java/technologies/javase/javase-jdk8-
downloads.html

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/

STEP 4: To download CHROME DRIVER


https://chromedriver.chromium.org/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:

1. Write a test case based on controls.


2. Test data in a flat file.
3. Manual test case to verify student grade
4. Write and test a program to select the students who have scored
more than 60 Percentage
5. Write and test a program to login a specific web page.
6. Write and test a program to get the number of list items in a list
/ combo box.
7. Test a HTML file.
8. Test a program in MS Excel for Data Driven Wizard.
9. Test the addition of two values in C++ Program.
10. Write a test suite containing minimum 4 test cases.

xiii
Notes

**********

xiv
List of Experiments
S. No Programs Page No

01 Write a Test Case Based on Controls 1

02 To Test Data in a Flat File 3

Manual Test Case for Verifying the


03 7
Students Grade

Write and Test Program to Select the


04 Number of Students Who have Scored 9
More than 60 Marks

Test a Program to Login a Specific Web


05 13
Page

Test a Program to get the Number of Items


06 17
in Combo Box

07 Test a HTML File 21

Test a Program in MS Excel Data Driven


08 25
Wizard

09 Test the Addition of Two Numbers 31

10 Test Suite Containing 4 Test Cases 35

xv
Notes
**********

xvi
Software Testing Tools

1. WRITE A TEST CASE BASED ON CONTROLS


AIM: To write a manual test case for a login page, using Controls.
ALGORITHM:
Step 1: Start the process.
Step 2: Create a test case which contain fields like Test case Id,
Test scenario, Test steps, Test data, Expected result, actual result,
pass/fail and comment.
Step 3: In Test case Id field generate the unique id for each cases.
Step 4: Test scenario comprises of the logics that are to be
performed for the login page with different case.
Step 5: Test steps involves methods in which way the test scenarios
are to be performed.
Step 6: Test data contains username and password in different
pattern.
Step 7: Expected result of the test scenario of login page is the
output.
Step 8: Actual result is one which is compared with expected
result.
Step 9: In the field pass/fail consists of indication for the result
type.
Step 10: Comment field is for providing message

Department of BCA 1
Software Testing Tools

TEST TEST TEST TEST EXPECT ACTUAL PASS COM


CAS SCENARI DATA DATA ED RESULT /FAIL MENT
E ID O RESULT
Login 1.Enter [email protected] Login to Directed Pass
TC01 with valid user ID. om next to new
data 2. Enter [email protected] page page
password. C
3.Click
submit
Login 1. Enter XYZ@gmail. Should New Verify
TC02 with user ID com give an page the
Invalid (with [email protected] error occurre user
user ID uppercase) C message d Fail ID
2.Enter and
password. redire
3. Click ction
submit. of
page
Login 1. Enter Should Showed
TC03 with user ID. [email protected] not login error
Invalid 2.Enter om & show message
password password(w 12345678 error Pass
ith only message
numbers)
3.Click
submit
Login 1. Enter [email protected] Show Redirect
TC04 with[char user ID. om error ed to the
acters 2.Enter aBcDefZw page/me new
only in password[w ssage page Fail
password ith
] character]
3.Click
submit
Login 1. Enter [email protected] Show Show
TC05 with user ID. om error error
password 2. Enter 12345@AB message message Pass
less than password. for page
defined 3.Click
No .of. submit
length

Department of BCA 2
Software Testing Tools

2. TO TEST DATA IN A FLAT FILE


AIM: To write a program to read the data from the excel file.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to work space and type code to access the excel sheet:
[File file = new File
(“c:\\users\\workspace\\testing\\book1.xlsx”); ]
Step 8: Open the MS Excel and write the data into sheets and save
it.
Step 9: Move to work space and type the code to display excel data:
[ XSSFRow row = sh.getRow(0);
int noofrows = row.getLastCellNum(); ]
Step 10: Save the program and execute it.

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

public class testexcel {

public static void main(String[] args) throws


FileNotFoundException {
int rowCount, colCount;
File file=new
File("C:\\Users\\workspace\\TestingExercise\\Book1.xlsx");
XSSFWorkbook wb;
XSSFSheet sh=null;
try{
wb= new XSSFWorkbook(file);
sh= wb.getSheet("Sheet2");
} catch (Exception e){ System.out.println("error"); }

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

3. MANUAL TEST CASE FOR VERIFYING THE STUDENT GRADE


AIM: To write manual test case for verifying the student grade.
ALGORITHM:
Step 1: Start the process.
Step 2: Create test case for student grade verification containing
fields like Test case Id, Test case description, positive/negative,
Precondition, Test steps, Test date, Expected result, Actual result,
Status, comments for verifying the students grade .
Step 3: In Test Id field contains unique id for each test cases.
Step 4: Test case description consists of different scenario for
verifying the student grade.
Step 5: Positive/negative field indicates the result type.
Step 6: Precondition involves planning for test case steps.
Step 7: Test step are methods in which the test case are carried
out.
Step 8: Test date on day the test was carried out.
Step 9: Output of the test scenario are mentioned in the expected
result.
Step 10: Actual result is existing result of the case
Step 11: Status is the current stage of the test cases.
Step 12: comment contains message for developer.
Step 13: Stop the process.

Department of BCA 7
Software Testing Tools

TE TES POSITI PRE TEST TEST EXPECTED ACTUAL PASS COM


ST T VE / CONDI STEPS DATE RESULT RESULT / MENT
CA CAS NEGAT TION FAIL
SE E IVE
ID DES
CRIP
TIO
N
TC- Test Positiv Getting 1.Verify 2/18/ 1.Programs 1. Program
stu a e studen program 2021 created. created. Pass
d. prog t mark for 2.Getting 2.Getting
Grd ram inform finding values. values
01 to ation student
verif grade
y 2.Getting
stud no of
ent students
grad 3.Getting
e student
mark
using
array
TC- Assig Positiv Total 1.Enter 2/18/ 2.Calculate Average
stu ning e marks the mark 2021 d average. was Pass
d grad to be for “n” 3.Assign calculated
Grd e for calcula students grade
02 parti ted
cular
mark
2.Get the
average=
sum of
subjects
/ total
no.of.sub
ject
Assign 3.If
grade average
based greater Pass
on than 90
marks grade will
>900
>80A
>70B
>60C
>50D
<50F
TC- If Positiv Error 1.Enter Throw error Throwed Gettin
stu enter e the the string 2/18/ as it is in error Pass g the
d ing Negativ string values 2021 compact data
grd strin e value value
03 g for
valu marks
es
for
stud
ents

Department of BCA 8
Software Testing Tools

4. WRITE AND TEST A PROGRAM TO SELECT THE NUMBER OF


STUDENTS WHO HAVE SCORED MORE THAN 60 MARKS
AIM: To write program to test percentage who scored above 60
percent.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to the work space and type the code in java to test data
with above 60 percent.
Step 8: [for (int i=0; i<n; i++)], for loop is created for percentage
calculation.
Step 9: [if (percentage[i] > 60)] is used to display the percentage
above 60.
Step 10: Save it and execute the code.

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

String name[] = new String[n];


int percentage[] = new int[n];

for(int i=0; i<n; i++){


System.out.println("Student Detail "+i);
System.out.print("Enter Name: ");
SC.nextLine();
name[i]=SC.nextLine();
System.out.print("Enter Percentage: ");
percentage[i]=SC.nextInt();
}

for (int j=0;j<n;j++){


if(percentage[j] > 60){
System.out.println("Student "+name[j]+" having
percentage"+percentage[j]+" has above 60
Percentage");

}
}

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

5. TEST A PROGRAM TO LOGIN A SPECIFIC WEB PAGE


AIM: To write code to test a program to login a specific webpage
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project \and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: Create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to workspace and type code to access web driver to get:
[driver.get(http://newtours.demoaut.com/);
Step 8: open notepad & write coding for webpage and save it in
selenium folder.
Step 9: Move to workspace and type the code.
Step 10: Save and execute it.

package Mytest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class loginwebpage {

public static void main(String[] args) throws


InterruptedException {

System.setProperty("webdriver.chrome.driver",
"C:\\Users \\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");

Department of BCA 13
Software Testing Tools

WebDriver driver = new ChromeDriver();


driver.get("http://newtours.demoaut.com/");

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

6. TEST A PROGRAM TO GET THE NUMBER OF ITEMS IN


COMBO BOX

AIM: To write a code to test a program to get the number of items in


combo box.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to workspace and type the codes to access web driver.
Step 8: Open notepad and create a html files for combo box and
save it in same locations of selenium.
Step 9: Move to workspace and type the coding to count the list of
items [int dropdowncount =listoptiondropdown.size(); ]
Step 10: Save it and execute the code.

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;

public class combocount {

Department of BCA 17
Software Testing Tools

public static void main(String[] args) {


System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");

WebDriver driver = new ChromeDriver();

driver.get("C:\\Users\\Malar\\workspace\\TestingExercise\\comb
ocount.html");

//Assign and Select the dropdown list element


Select selectDropdown = new
Select(driver.findElement(By.id("cbo1")));

//Get all the option from dropdown list and assign into List
java.util.List<WebElement> listOptionDropdown =
selectDropdown.getOptions();

// Count the item dropdown list and assign into integer


variable
int dropdownCount = listOptionDropdown.size();

//Print the total count of dropdown list using integer variable


System.out.println("Total Number of item count in dropdown
list = " + dropdownCount);
}
}

Combocount.html
<html>
<body>

Department of BCA 18
Software Testing Tools

<h1><center>Program to check Combo Items</center></h1>


<h3>Select the Department</h3>
<select id="cbo1">
<option>B.Sc CS</option>
<option>B.Sc IT</option>
<option>BCA</option>
<option>B.Com CA</option>
<option>BBA</option>
<option>BA</option>
</select>
</body>
</html>
Output:

Department of BCA 19
Software Testing Tools

Department of BCA 20
Software Testing Tools

7. TEST A HTML FILE


AIM: To write a code to test a html file in selenium.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to workspace and type the codes to access web driver.
Step 8: Open notepad and create a simple html file and save it in
same location of selenium.
Step 9: Move to workspace and type the coding to import the html
file in browser.
Step 10: Save and execute it.

package Mytest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class testhtml {

public static void main(String[] args) {

// TODO Auto-generated method stub


System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");

// TODO Auto-generated method stub

Department of BCA 21
Software Testing Tools

WebDriver driver = new ChromeDriver();

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

8. TEST A PROGRAM IN MS EXCEL DATA DRIVEN WIZARD


AIM: To test a program in MS-Excel file using data driven wizard.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select new –
package and name it and click finish button.
Step 5: create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Get to access the excel sheet:
[File file = new
File(“C:/Users/Savithar/Desktop/Student.xls”); ]
Step 8: Define a cell format using,
times = new WritableCellFormat(times10pt);
Step 9: Update the excel data using data driven wizard:
student_excel_write test = new student_excel_write();
test.setOutputFile("C:/Users/Savitha/Desktop/Student.xls");
test.write();
Step 10: Save the program and execute it.

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

// Define the cell format


times = new WritableCellFormat(times10pt);
// Lets automatically wrap the cells
times.setWrap(true);
// Create a bold font with underlines
WritableFont times10ptBoldUnderline = new WritableFont(
WritableFont.TIMES, 10, WritableFont.BOLD, false,
UnderlineStyle.SINGLE);
timesBoldUnderline = new
WritableCellFormat(times10ptBoldUnderline);
// Lets automatically wrap the cells
timesBoldUnderline.setWrap(true);
CellView cv = new CellView();
cv.setFormat(times);
cv.setFormat(timesBoldUnderline);
cv.setAutosize(true);
// Write a few headers
addCaption(sheet, 0, 0, "Student Name");
addCaption(sheet, 1, 0, "Subject 1");
addCaption(sheet, 2, 0, "subject 2");
addCaption(sheet, 3, 0, "subject 3");
}
private void createContent(WritableSheet sheet) throws
WriteException,
RowsExceededException {
// Write a few number
for (int i = 1; i < 10; i++) {
// First column
addLabel(sheet, 0, i, "Student " + i);
// Second column
addNumber(sheet, 1, i, ((i*i)+10));
addNumber(sheet, 2, i, ((i*i)+4));
addNumber(sheet, 3, i, ((i*i)+3));
}

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

9. TEST THE ADDITION OF TWO NUMBERS


AIM: To write a program to add two numbers in the web page.
ALGORITHM:
Step 1: Launch the eclipse.exe file inside the “eclipse folder”.
Step 2: Select the default location to select the workplace location.
Step 3: Create a new project through File – New – java project.
Name the project and click the finish button.
Step 4: Right click the newly created project and select New –
package and name it and click finish button.
Step 5: Create a java class by right clicking on the package – New
class and name it.
Step 6: Right click on the project name – properties – java build
path – select libraries tab – click on add external jar – selenium jar.
Step 7: Go to work space and type the code to import the web
driver.
[ webDriver driver = new chromedriver();
driver.get(“c:\\users\\desktop\\progrum.html”); ]
Step 8: Open notepad, write html program with three text box.
Step 9: Move to work space and type the code to calculate two
numbers.
[ int total= value1 + value2; ]
Step 10: Save it and execute the program.

package Mytest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class addtwonumbers {

public static void main(String[] args) {

Department of BCA 31
Software Testing Tools

System.setProperty("webdriver.chrome.driver", "C:\\Users
\\Desktop\\SP\\Testing SW\\TCS
Addon\\Softwares\\chromedriver.exe");

WebDriver driver = new ChromeDriver();


driver.get("C:\\Users\\Desktop\\SP\\Testing\\prgsum.html
");

String data = "200";


String data2 = "100";

driver.findElement(By.name("txt1")).sendKeys("200".toString())
;
driver.findElement(By.name("txt2")).sendKeys("100".toString())
;

int value1 = Integer.parseInt(data);


int value2 = Integer.parseInt(data2);
int total = value1 + value2;

driver.findElement(By.name("txt3")).sendKeys(
String.valueOf(total));
}
}

prgsum.html file
<html>
<head>
<title>Login </title>
</head>
<body>

<h4><center> Adding Two Numbers</center> </h4> </br>


<p5>Value 1 : </p5>

Department of BCA 32
Software Testing Tools

<input type="text" name="txt1"> </br> </br>


<p6>Value 2 :</p6>
<input type="text" name="txt2"> </br></br>
<p7>Result :</p7>
<input type="text" name="txt3"> </br>
</body>
</html>

Output:

Department of BCA 33
Software Testing Tools

Notes
**********

Department of BCA 34
Software Testing Tools

10. TEST SUITE CONTAINING 4 TEST CASES


AIM: To write a program to test suite containing 4 test cases.
ALGORITHM:
Step 1: Launch the Selenium IDE.exe file.
Step 2: Select the default location to select the workplace location.
Step 3: Open notepad, write html program for Arithmetic
operations.
C:/Users/Savitha/Desktop/Arithmetic operation.html
Step 4: Open the Selenium IDE environment.
Step 5: Click the record Button to record the process as a test
suite.
Step 6: Open that already saved html file and execute it.
Step 7: Selenium IDE automatically save the background process
of the test suite.
Step 8: Save and execute the program.

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

Enter Second Numeric Value : <input type="number" id="value2">


</br>
</br>
Result of the Arithmetic operation is : <output type="number"
id="value3"> </output></br>
<input type="button" Value="Addition" onClick=Addition()> </br>
<input type="button" Value="Subtraction"
onClick=Subtraction()></br>
<input type="button" Value="Multiplication"
onClick=Multiplication()></br>
<input type="button" Value="Division" onClick=Division()></br>
</form>
</body>
</html>

OUTPUT

Test case 1

Department of BCA 37
Software Testing Tools

Test case 2

Test case 3

Test case 4

Department of BCA 38

You might also like