0% found this document useful (0 votes)
31 views38 pages

ST Lab FINAL

The document is a bonafide certificate template from M.A.M. College of Engineering for practical work in the Department of Computer Applications. It includes a list of experiments related to software testing, along with viva questions and answers covering various software testing concepts. Additionally, it contains example code snippets for practical exercises such as data flow testing, Excel file manipulation, and web page login functionality.

Uploaded by

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

ST Lab FINAL

The document is a bonafide certificate template from M.A.M. College of Engineering for practical work in the Department of Computer Applications. It includes a list of experiments related to software testing, along with viva questions and answers covering various software testing concepts. Additionally, it contains example code snippets for practical exercises such as data flow testing, Excel file manipulation, and web page login functionality.

Uploaded by

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

M.A.M.

COLLEGE OF ENGINEERING
TRICHY - 621 105.
http:// www.mamce.org

DEPARTMENT OF COMPUTER APPLICATIONS

BONAFIDE CERTIFICATE

This is to certify that this Practical work titled

is

the bonafide work of

Register Number during the year 20 – 20 .

Faculty Incharge Head of the Department

Submitted for the Anna University Practical Examination held on

at M.A.M. College of Engineering, Trichy - 627 105.

Internal Examiner External Examiner

AN ISO 9001:2000 CERTIFIED INSTITUTION


CONTENT

SNO DATE LIST OF EXPERIMENTS MARKS SIGNATURE


1 Perform data flow testing for any C program to verify
the def-use variables (Ex: largest of two numbers)
2 Using Selenium IDE, Write a test suite containing
minimum 4 test cases for any simple C program.
3 Write and test a program to update 10 student records
into tables into Excel file.
4 Write and test a program to select the number of
students who have scored more than 60 in any one
subject (or all subjects).
5 Write and test a program to login to a specific web
page.
6 Write and test a program to provide a total number of
objects present / available on the page.
7 Write and test a program to get the number of list
items in a list / combo box.
8 Identify system specification and design test cases to
test any application using any one of a testing tool
(Selenium/Bugzilla/TestDirector)
9 Automate the test cases of the above system using any
test automation tool (Bugzilla /QA Complete)
10 Design test cases for web pages to test any web sites
(Web Performance Analyzer/Open STA)
VIVA QUESTIONS

1) Define software Testing.

 Testing can be described as a process used for revealing defects in software, and for
establishing that the software has attained a specified degree of quality with respect to
selected attributes.

2) Define process in the context of software quality.

 Process, in the software engineering domain, is a set of methods, practices, Standards,


documents, activities, polices, and procedures that software engineers use to develop
and maintain a software system and its associated artifacts, such as project and test
plans, design documents, code, and manuals.

3) Define the term Debugging or fault localization.


 Debugging or fault localization is the process of

 Locating the fault or defect


 Repairing the code, and
 Retesting the code.

4) Define Error.
 An error is mistake or misconception or misunderstanding on the part of a software
developer.

5) Define Faults (Defects).

 A fault is introduced into the software as the result of an error. It is an anomaly in the
software that may cause nit to behave incorrectly, and not according to its specification.

6) Define failures.

 A failure is the inability of a software or component to perform its required functions within
specified performance requirements.
7) Distinguish between fault and failure.

Fault Failure
fault is introduced into the software as the result failure is the inability of a software or
n error. It is an anomaly in the software that may ponent to perform its required functions
e nit to behave incorrectly, and not according to in specified performance requirements.
its
ification.

8) Define Test Cases.

A test case in a practical sense is attest related item which contains the following information.

 A set of test inputs. These are data items received from an external source by the
code under test. The external source can be hardware, software, or human.
 Execution conditions. These are conditions required for running the test, for
example, a certain state of a database, or a configuration of a hardware device.

 Expected outputs. These are the specified results to be produced by the code under
test.

9) Write short notes on Test, Test Set, and Test Suite.

 A Test is a group of related test cases, or a group of related test cases and test procedure.

 A group of related test is sometimes referred to as a test set

 A group of related tests that are associated with a database, and are usually run
together, is sometimes referred to as a Test Suite.

10) Define Software Quality.

 Quality relates to the degree to which a system, system component, or process meets
specified requirements.

 Quality relates to the degree to which a system, system component, or process


meets Customer or user needs, or expectations.
11) List the Quality Attributes.
 Correctness
 Reliability
 Usability
 Integrity
 Portability
 Maintainability
 Interoperability
12) Define Smart Tester.
Software must be tested before it is delivered to users. It is responsibility of the testers to Design
tests that (i) reveal defects

(ii) can be used to evaluate software performance, usability and reliability. To achieve these goals,
tester must select a finite no. of test cases (i/p, o/p, & conditions).

13) Write short notes on Random testing and Equivalence class portioning.
 Each software module or system has an input domain from which test input data is selected.
If a tester randomly selects inputs from the domain, this is called random testing. In
equivalence class partitioning the input and output is divided in to equal classes or
partitions.

14) Define Finite-State machine.

 A finite-state machine is an abstract machine that can be represented by a state graph having
a finite number of states and a finite number of transitions between states.

15) Define Error Guessing

 The tester/developer is sometimes able to make an educated “guess’ as to which type of


defects may be present and design test cases to reveal them. Error Guessing is an ad-hoc
approach to test design in most cases.

16) Write the application scope of adequacy criteria?

 Helping testers to select properties of a program to focus on during test.

 Helping testers to select a test data set for a program based on the selected properties.
 Supporting testers with the development of quantitative objectives for testing

 Indicating to testers whether or not testing can be stopped for that program.

17) Define path.

 A path is a sequence of control flow nodes usually beginning from the entry node of a
graph through to the exit node.

18) Write the formula for cyclomatic complexity?

 The complexity value is usually calculated from control flow graph(G) by the
formula. V(G) = E-N+2. Where The value E is the number of edges in the control flow
graph The value N is the number of nodes.

19) What are the errors uncovered by black box testing?

 Incorrect or missing functions Interface errors


 Errors in data structures Performance errors
 Initialization or termination error

20) List the levels of Testing or Phases of testing.

 Unit Test
 Integration Test
 System Test
 Acceptance Test
21) Define Unit Test and characterized the unit test.

 At a unit test a single component is tested. A unit is the smallest possible testable
software component.

 It can be characterized in several ways

 A unit in a typical procedure oriented software systems.


 It performs a single cohensive function.
 It can be compiled separately.
 It contains code that can fit on a single page or a screen.
22) List the phases of unit test planning.
Unit test planning having set of development phases.

Phase1: Describe unit test approach and risks.

Phase 2: Identify unit features to be tested.


Phase 3: Add levels of detail to the plan.

23) Define integration Test.

 At the integration level several components are tested as a group and the tester investigates
component interactions.
24) Define System test.
 When integration test are completed a software system has been assembled and its major
subsystems have been tested. At this point the developers /testers begin to test it as a whole.
System test planning should begin at the requirements phase.

25) Define Alpha and Beta Test

 Alpha test developer’s to use the software and note the problems.

 Beta test who use it under real world conditions and report the defect to the Developing
organization.

26) What are the approaches are used to develop the software?

There are two major approaches to software development

 Bottom-Up
 Top_Down

These approaches are supported by two major types of programming languages. They are

 procedure_oriented
 Object_oriented
27) Define test Harness.

 The auxiliary code developed into support testing of units and components is called a test
harness. The harness consists of drivers that call the target code and stubs that represent
modules it calls.

28) Define Test incident report.

 The tester must determine from the test whether the unit has passed or failed the test. If
the test is failed, the nature of the problem should be recorded in what is sometimes
called a test incident report.

29) What is meant by regression testing?

 Regression testing is used to check for defects propagated to other modules by changes
made to existing program. Thus, regression testing is used to reduce the side effects of
the changes.

30) Define stress Testing.

 When a system is tested with a load that causes it to allocate its resources in maximum
amounts .It is important because it can reveal defects in real-time and other types of
systems. which it will crash. This is sometimes called “breaking the system”.

****************
1) Perform data flow testing for any C program to verify the def-use variables
(Ex: largest of two numbers)

#include <stdio.h>
int main() {
int a, b;
printf("Please Enter Two different values\n");
scanf("%d %d", &a, &b);
if(a > b)
{
printf("%d is Largest\n", a);
}
else if (b > a)
{
printf("%d is Largest\n", b);
}
else
{
printf("Both are Equal\n");
}
return 0;
}

OUTPUT:
Please Enter Two different values

20

10

20 is Largest

RESULT:
2) Using Selenium IDE, write a test suite containing minimum 4 test cases.

RESULT:
3) Write and test a program to update 10 student records into tables into
Excel file. (Selenium)
package EXCEL;
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;
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 excel
{
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
{
WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
times = new WritableCellFormat(times10pt);
times.setWrap(true);
WritableFont times10ptBoldUnderline = new WritableFont( WritableFont.TIMES, 10,
WritableFont.BOLD, false, UnderlineStyle.SINGLE);
timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
timesBoldUnderline.setWrap(true);
CellView cv = new CellView();
cv.setFormat(times);
cv.setFormat(timesBoldUnderline);
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 {
for (int i = 1; i < 10; i++)
{ addLabel(sheet, 0, i, "Student " +
i); addNumber(sheet, 1, i, ((i*i)
+10));
addNumber(sheet, 2, i, ((i*i)+4));
addNumber(sheet, 3, i, ((i*i)+3));
}
}
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,
double 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
{
excel test = new excel();
test.setOutputFile("D://student.xls"); test.write();
System.out.println("Please check the result file under D://shanthi/student.xls ");
}
}

OUTPUT:

RESULT:
4) Write and test a program to select the number of students who have scored
more than 60 in any one subject (or all subjects). (Selenium)
package EXCEL;
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.CellType;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class excel {
private String inputFile;
public void setInputFile(String inputFile){
this.inputFile = inputFile;
}
public void read() throws
IOException{ File inputWorkbook = new
File(inputFile); Workbook w;
boolean flag=false;
int count=0;
try{
w= Workbook.getWorkbook(inputWorkbook);
Sheet sheet = w.getSheet(0);
for (int j = 0; j < sheet.getRows(); j++)
{
for (int i = 0; i < sheet.getColumns(); i++)
{
Cell cell = sheet.getCell(i, j);
if (cell.getType() == CellType.NUMBER){
if(Integer.parseInt(cell.getContents())>60){
flag = true;
if(flag == true){
count++;
flag=false;
}
break;
}}}}
System.out.println("Total number of students who scored more than 60 in one or more subjects is: "
+count);
}
catch (BiffException e){
e.printStackTrace();
}
}
public static void main(String[] args) throws IOException{
excel test = new excel();
test.setInputFile("D://shanthi/studentmark.xls");
test.read();
}
}
OUTPUT:

RESULT:
5. Write and test a program to login to a specific web page. (Selenium)
Login.html
<html><head><title> Login Page</title></head>
<body><br><br><br><h1><center>LOGIN PAGE</center></h1>
<form action="login1.html" method="post"><br>
<table align="center" bgcolor="skyblue" width="600" cellpadding="10" cellspacing="15">
<tr><td>User Name </td><td>
<input type="text" name="un" value="enter user name "></td></tr>
<tr><td>Password </td><td>
<input type="text" name="pw" value="enter password "></td></tr>
<tr><td></td><td>
<input type="button" name="b1"onClick="location.href='login1.html'"value="SignIn"></td></tr></table>
</form></body></html>
Login1.html
<html><head><title> Welcome To This Web Page</title>
</head><body><center><br><br>
<font size="5">login successfully!!!!</font><br><br><br><br><br>
<img src="icon.jpg" width="500" height="400">
</center></body></html>

Login.java
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.*;
public class login {
public static void main(String[] args) throws InterruptedException
{ System.out.println("Welcome, Login sucessfully!!!");
System.setProperty("webdriver.gecko.driver","D:/shanthi/geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("file:///C:/Users/DIJIKTRA2/Desktop/login.html");
Thread.sleep(1000);
driver.findElement(By.name("un")).clear();
driver.findElement(By.name("un")).click();
Thread.sleep(1000);
driver.findElement(By.name("un")).sendKeys("shanthibca17@gmail.com");
Thread.sleep(1000);
driver.findElement(By.name("pw")).clear();
Thread.sleep(1000);
driver.findElement(By.name("pw")).click();
Thread.sleep(1000);
driver.findElement(By.name("pw")).sendKeys("shanthi71@");
Thread.sleep(1000);
driver.findElement(By.name("b1")).click();
}
}
OUTPUT:

RESULT:
6. Write and test a program to provide a total number of objects present /
available on the page. (Selenium)
register.html
<html>
<head>
<title>Student Registration Form</title>
</head>
<body>
<center><h3><u>STUDENT REGISTRATION FORM</u></h3> </center>
<table align="center" cellpadding = "10">
<tr>
<td>FIRST NAME</td>
<td><input type="text" name="First_Name" maxlength="30"/>
</td>
</tr>
<tr>
<td>LAST NAME</td>
<td><input type="text" name="Last_Name" maxlength="30"/>
</td>
</tr>
<tr>
<td>DATE OF BIRTH</td>
<td>
<select name="Birthday_day" id="day">
<option value="-1">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="31">31</option>
</select>
<select name="Birthday_Month" id="month">
<option value="-1">Month</option>
<option value="January">Jan</option>
<option value="February">Feb</option>
<option value="March">Mar</option>
<option value="April">Apr</option>
<option value="May">May</option>
<option value="June">Jun</option>
<option value="July">Jul</option>
<option value="August">Aug</option>
<option value="September">Sep</option>
<option value="October">Oct</option>
<option value="November">Nov</option>
<option value="December">Dec</option>
</select>
<select name="Birthday_Year" id="year">
<option value="-1">Year</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
</select>
</td>
</tr>
<tr>
<td>GENDER</td>
<td>
<input type="radio" name="Gender" value="Male" /> Male
<input type="radio" name="Gender" value="Female" /> Female
<input type="radio" name="Gender" value="Others" /> Others
</td></tr><tr><td> LANGUAGES KNOWN</td><td>
<input type="checkbox" name="lang" value="Java" checked="checked"> Java<br><br>
<input type="checkbox" name="lang" value="PHP" > PHP<br><br>
<input type="checkbox" name="lang" value="C#" > C#<br><br>
<input type="checkbox" name="lang" value="Python" > Python<br><br>
<input type="checkbox" name="lang" value="ruby" checked="checked"> Ruby<br><br>
<input type="checkbox" name="lang" value="Javascript" checked="checked">Javascript<br><br>
<input type="checkbox" name="lang" value="C"> C<br><br>
<input type="checkbox" name="lang" value="perl" checked="checked"> Perl<br><br>
<input type="checkbox" name="lang" value="C++"> C++<br><br>
<input type="checkbox" name="lang" value="sql"> SQL<br>
</td><tr>
<td colspan="2" align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</td></tr></table></form>
</body>
</html>

object.java:
package object;
import java.util.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class object {
public static void main(String args[])
{ System.setProperty("webdriver.gecko.driver","D:/shanthi/geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("file:///E:/haseena/register.html");
List <WebElement> mylist=driver.findElements(By.xpath("//*"));
System.out.println("Number of items="+mylist.size());
}
}

OUTPUT:

RESULT:
7) Write and test a program to get the number of list items in a list / combo
box. (Selenium)
register.html
<html>
<head>
<title>Student Registration Form</title>
</head>
<body>
<center><h3><u>STUDENT REGISTRATION FORM</u></h3> </center>
<table align="center" cellpadding = "10">
<tr>
<td>FIRST NAME</td>
<td><input type="text" name="First_Name" maxlength="30"/>
</td>
</tr>
<tr>
<td>LAST NAME</td>
<td><input type="text" name="Last_Name" maxlength="30"/>
</td>
</tr>
<tr>
<td>DATE OF BIRTH</td>
<td>
<select name="Birthday_day" id="day">
<option value="-1">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="31">31</option>
</select>
<select name="Birthday_Month" id="month">
<option value="-1">Month</option>
<option value="January">Jan</option>
<option value="February">Feb</option>
<option value="March">Mar</option>
<option value="April">Apr</option>
<option value="May">May</option>
<option value="June">Jun</option>
<option value="July">Jul</option>
<option value="August">Aug</option>
<option value="September">Sep</option>
<option value="October">Oct</option>
<option value="November">Nov</option>
<option value="December">Dec</option>
</select>
<select name="Birthday_Year" id="year">
<option value="-1">Year</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
</select>
</td>
</tr>
<tr>
<td>GENDER</td>
<td>
<input type="radio" name="Gender" value="Male" /> Male
<input type="radio" name="Gender" value="Female" /> Female
<input type="radio" name="Gender" value="Others" /> Others
</td></tr><tr><td> LANGUAGES KNOWN</td><td>
<input type="checkbox" name="lang" value="Java" checked="checked"> Java<br><br>
<input type="checkbox" name="lang" value="PHP" > PHP<br><br>
<input type="checkbox" name="lang" value="C#" > C#<br><br>
<input type="checkbox" name="lang" value="Python" > Python<br><br>
<input type="checkbox" name="lang" value="ruby" checked="checked"> Ruby<br><br>
<input type="checkbox" name="lang" value="Javascript" checked="checked">Javascript<br><br>
<input type="checkbox" name="lang" value="C"> C<br><br>
<input type="checkbox" name="lang" value="perl" checked="checked"> Perl<br><br>
<input type="checkbox" name="lang" value="C++"> C++<br><br>
<input type="checkbox" name="lang" value="sql"> SQL<br>
</td><tr>
<td colspan="2" align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</td></tr></table></form>
</body>
</html>

Test.java:
package test;
import java.util.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class test {
public static void main(String args[])
{ System.setProperty("webdriver.gecko.driver","D:/shanthi/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("file:///D:/shanthi/reg.html");
Select se = new Select(driver.findElement(By.xpath("//Select[@id='year']")));
List <WebElement> mylist=se.getOptions();
mylist.size();
System.out.println("Number of items = "+mylist.size());
}
}
OUTPUT:

RESULT:
Ex.no :08 Identify system specification and design test cases to test any application
using any one of a testing tool.

Test Cases of Store Management System Project (Testing)


Login
Test Engineer: SHANTHI.G
Test Case ID: 1
Related UC/FR/NFR UC/FR/NFR
Date: 02-01-2014
Purpose: The purpose of this test insure that the user can log in with his id to use this
app.
Pre-Req: The user enters his correct name and password for a successful login page.
Test Data: sname, sid, spassword
The steps are below.
visit Login Page
enter UserId
enter password
Steps:
click login
recovery password
change password
keep login
Status: Pass

MAIN FORM
Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 2
Related UC/FR/NFR UC/FR/NFR
Date: 03-01-2014
The purpose of this test is to make sure that the design of the front page of the
Purpose:
app is consistent and readable.
Pre-Req: The main activity of the app should be up and running.
Test Data: none (test is just visual test)
Following steps will take place in the test
Latest orders
Top customers
Steps: Recent products
Recent customers
Graph by amount and order
Graph by day/month/year
Status: Pass

EMPLOY RECORDS
Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 3
Related UC/FR/NFR UC/FR/NFR

Date: 03-01-2014

The purpose of this test for registered employ by his name, password, email,
Purpose:
and mobile number for use this app and work on the app.
Pre-Req: Employ sure that login with his name and id to use this app.
Test Data: none (test is just visual test)
Step formatting rules below.
enter employ name
Steps: enter employ password
enter employ email
enter employ a mobile number
Status: Pass

CATEGORY RECORD
Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 4
Related UC/FR/NFR UC/FR/NFR
Date: 04-01-2014
Purpose: The purpose of this testing to insert, update, delete and view category.
Pre-Req: The user enter category by its correct name.

Test Data:
Txtcatogaryname
Step formatting rules below.
open the category form
insert the category name of items
update the category name of items
Steps:
delete the category name of items
insert the category name of items
view the category names
Export the category records to MS Excel.
Status: Pass

CUSTOMER RECORD
Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 5
Related UC/FR/NFR UC/FR/NFR
Date: 05-01-2014
The purpose of this testing to registered the new customer by his name, address,
Purpose:
id number and phone number for sales items.
Pre-Req: The user can easily search customer by name with all data.
Test Data: Scustmrname, scsutmradress, scustmrmblnumer, scustmremail
Step formatting rules below.
1. automatically generate customer-id
2. enter the customer name
Steps: 3. enter customer address
4. enter customer id number
5. enter customer city
6. enter customer mobile number
7. enter customer email
Status: Pass

ITEMS RECORD AND CONFIGURATION


Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 6
Related UC/FR/NFR UC/FR/NFR
Date: 05-01-2014
The purpose of this testing to enter item code, name and price and also can
Purpose:
modify name and price of items.
Pre-Req: Employ can search items by name and code.
Test Data: none (test is just visual test)
Step formatting rules below.
insert items code
Steps: insert items name with price
update items name or price
delete items name
Status: Pass

SALES AND REPORT


Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 7
Related UC/FR/NFR UC/FR/NFR
Date: 05-01-2014
Purpose: The purpose of this testing to sales items with discount and print invoice of sales.
Pre-Req: The user can check records for recent or old sales by report or data.
Test Data: none (test is just visual test)
Step formatting rules below.
Steps: sales items with quantity
discount to customer
payment due
print crystal report of sales
print excel report of sales
Status: Pass

Stock
Test Engineer: Here, you can mention the Name of the test engineer
Test Case ID: 8
Related UC/FR/NFR UC/FR/NFR
Date: 05-09-2014
The purpose of this test for check quantities of items in which user can modify
Purpose:
items day by day.
Pre-Req: The user can see the quantities are below in the range or above in the range.
Test Data: None
Step formatting rules below.
set the quantities of items
update the quantities of items
Steps:
delete the quantities of items
if quantities less than 200 than message show with yellow color
if quantities equal to zero than message show with red color
Status: Pass
Ex.no : 09
Automate the test cases of the above system using any test automation tool.

Testing Login Functionality of a Web App


We’ll write test cases for the login feature using the Selenium WebDriver automation tool in Python. Before
running the code, we should have installed Selenium WebDriver and our browser’s appropriate web drivers
(e.g., ChromeDriver).
Step 1: Setup the WebDriver by importing the required libraries.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome()
driver.maximize_window()
Step 2: Define test case scenarios and test data.
valid_username = "testuser123"
valid_password = "Test@123"
invalid_username = "invaliduser"
invalid_password = "invalidpassword"
test_scenarios = [
{"username": valid_username, "password": valid_password, "expected_result": "success"},
{"username": invalid_username, "password": valid_password, "expected_result": "failure"},
{"username": valid_username, "password": invalid_password, "expected_result": "failure"},
{"username": invalid_username, "password": invalid_password, "expected_result": "failure"},
]
Step 3: Write the test case function to execute the login test cases.
def test_login(username, password, expected_result):
driver.get("https://example.com/login")
username_input = driver.find_element(By.NAME, "username")
password_input = driver.find_element(By.NAME, "password")
login_button = driver.find_element(By.XPATH, "//button[contains(text(), 'Login')]")
username_input.clear()
username_input.send_keys(username)
password_input.clear()
password_input.send_keys(password)
login_button.click()
time.sleep(2)
if expected_result == "success":
welcome_message = driver.find_element(By.XPATH, "//h1[contains(text(), 'Welcome')]")
assert welcome_message.is_displayed(), "Login failed. Welcome message not displayed."
elif expected_result == "failure":
error_message = driver.find_element(By.XPATH, "//div[@class='error-message']")
assert error_message.is_displayed(), "Expected error message not displayed."
time.sleep(2)
Step 4: Execute the test cases.
for scenario in test_scenarios:
username = scenario["username"]
password = scenario["password"]
expected_result = scenario["expected_result"]
print(f"Testing login with username: {username}, password: {password}")
test_login(username, password, expected_result)
driver.quit()
In this example, four test scenarios are defined, each involving different combinations of valid and invalid
usernames and passwords.
The test_login function inputs the username, password, and expected result and performs the login operation
using Selenium WebDriver.
It then checks whether the login was successful based on the desired result.
Ex.no : 10
Design test cases for web pages to test any web sites

Assumptions: Assume that your application supports the following functionalities:


 Forms with various fields
 Child windows
 The application interacts with the database
 Various search filter criteria and display results
 Image upload
 Send email functionality
 Data export functionality
General Test Scenarios
1. All mandatory fields should be validated and indicated by an asterisk (*) symbol.
2. Validation error messages should be displayed properly and in the correct position.
3. All error messages should be displayed in the same CSS style (For Example, using red color)
4. General confirmation messages should be displayed using CSS style other than error message style (For
Example, using green color)
5. Tooltips text should be meaningful.
6. Drop-down fields should have the first entry as blank or text like “Select”.
7. ‘Delete functionality’ for any record on the page should ask for a confirmation.
8. Select/deselect all records option should be provided if page supports record add/delete/update functionality
9. Amount values should be displayed with the correct currency symbols.
10. Default page sorting should be provided.
11. Reset button functionality should set default values for all fields.
12. All numeric values should be formatted properly.
13. Input fields should be checked for the max field value. Input values greater than the specified max
limit should not be accepted or stored in the database.
14. Check all input fields for special characters.
15. Field labels should be standard e.g., the field accepting the user’s first name should be labeled properly
as ‘First Name’.
16. Check page sorting functionality after add/edit/delete operations on any record.
17. Check for timeout functionality. Timeout values should be configurable. Check application behavior after
the operation timeout.
18. Check the cookies used in the application.
19. Check if the downloadable files are pointing to the correct file path.
20. All resource keys should be configurable in config files or databases instead of hard coding.
21. Standard conventions should be followed throughout for naming resource keys.
22. Validate markups for all web pages (validate HTML and CSS for syntax errors) to make sure they are
compliant with the standards.
23. Application crashes or unavailable pages should be redirected to the error page.
24. Check the text on all pages for spelling and grammatical errors.
25. Check numeric input fields with character input values. A proper validation message should appear.
26. Check for negative numbers if allowed for numeric fields.
27. Check the number of fields with decimal number values.
28. Check the functionality of buttons available on all pages.
29. The user should not be able to submit a page twice by pressing the submit button in quick succession.
30. Divide by zero errors should be handled for any calculations.
31. Input data with the first and last position blank should be handled correctly.
GUI and Usability Test Scenarios
1. All fields on the page (For Example, text box, radio options, drop-down lists) should be aligned properly.
2. Numeric values should be justified correctly unless specified otherwise.
3. Enough space should be provided between field labels, columns, rows, error messages, etc.
4. The scrollbar should be enabled only when necessary.
5. Font size, style, and color for headline, description text, labels, infield data, and grid info should
be standard as specified in SRS.
6. The description text box should be multi-lined.
7. Disabled fields should be greyed out and users should not be able to set focus on these fields.
8. Upon clicking on the input text field, the mouse arrow pointer should get changed to the cursor.
9. The user should not be able to type in the drop-down select list.
10. Information filled out by users should remain intact when there is an error message on the page submitted.
The user should be able to submit the form again by correcting the errors.
11. Check if proper field labels are being used in error messages.
12. Drop-down field values should be displayed in defined sort order.
13. Tab and Shift+Tab order should work properly.
14. Default radio options should be pre-selected on the page load.
15. Field-specific and page-level help messages should be available.
16. Check if the correct fields are highlighted in case of errors.
17. Check if the drop-down list options are readable and not truncated due to field size limits.
18. All buttons on the page should be accessible with keyboard shortcuts and the user should be able to
perform all operations using a keyboard.
19. Check all pages for broken images.
20. Check all pages for broken links.
21. All pages should have a title.
22. Confirmation messages should be displayed before performing any updates or deleting operations.
23. Hourglass should be displayed when the application is busy.
24. Page text should be left-justified.
25. The user should be able to select only one radio option and any combination for checkboxes.
Test Scenarios for Filter Criteria
1. The user should be able to filter results using all parameters on the page.
2. Refine search functionality should load the search page with all user-selected search parameters.
3. When there are at least one filter criteria required to perform the search operation, then make sure that
the proper error message is displayed when the user submits the page without selecting any filter criteria.
4. When at least one filter criteria selection is not compulsory, the user should be able to submit the page and
the default search criteria should be used to query results.
5. Proper validation messages should be displayed for all invalid values for filter criteria.

Test Scenarios for Result Grid


1. The page loading symbol should be displayed when it’s taking longer than the default time to load the
results page.
2. Check if all the search parameters are used to fetch data shown on the result grid.
3. The total number of results should be displayed in the result grid.
4. Search criteria used for searching should be displayed in the result grid.
5. Result grid values should be sorted by the default column.
6. Sorted columns should be displayed with a sort icon.
7. Result grids should include all the specified columns with the correct values.
8. Ascending and descending sorting functionality should work for columns supported by data sorting.
9. Result grids should be displayed with proper column and row spacing.
10. Pagination should be enabled when there are more results than the default result count per page.
11. Check for Next, Previous, First and Last page pagination functionality.
12. Duplicate records should not be displayed in the results grid.
13. Check if all the columns are visible and a horizontal scrollbar is enabled if necessary.
14. Check the data for dynamic columns (columns whose values are calculated dynamically based on
the other column values).
15. For result grids showing reports, check the ‘Totals’ row and verify the total for every column.
16. For result grids showing reports, check the ‘Totals’ row data when pagination is enabled and the user
gets navigated to the next page.
17. Check if proper symbols are used for displaying column values e.g. % symbol should be displayed
for percentage calculation.
18. Check result grid data to see if the date range is enabled.

Test Scenarios for a Window


1. Check if the default window size is correct.
2. Check if the child window size is correct.
3. Check if there is any field on the page with default focus (in general, the focus should be set on the first
input field of the screen).
4. Check if child windows are getting closed upon closing the parent/opener window.
5. If the child window is opened, the user should not be able to use or update any field in the background or
parent window
6. Check the window to minimize, maximize, and close functionality.
7. Check if the window is re-sizable.
8. Check the scroll bar functionality for parent and child windows.
9. Check the cancel button functionality for the child window.

Database Testing Test Scenarios


1. Check if the correct data is getting saved in the database upon a successful page submit.
2. Check values for columns that are not accepting null values.
3. Check for data integrity. Data should be stored in single or multiple tables based on the design.
4. Index names should be given as per the standards e.g. IND_<Tablename>_<ColumnName>
5. Tables should have a primary key column.
6. Table columns should have description information available (except for audit columns like created date,
created by, etc.)
7. For every database add/update operation logs should be added.
8. Required table indexes should be created.
9. Check if data is committed to the database only when the operation is successfully completed.
10. Data should be rolled back in case of failed transactions.
11. Database name should be given as per the application type i.e., test, UAT, sandbox, live (though this is not
a standard it is helpful for database maintenance)
12. Database logical names should be given according to the database name (again this is not standard but
helpful for DB maintenance).
13. Stored procedures should not be named with a prefix “sp_”
14. Check if values for table audit columns (like created date, created by, updated, updated by, is deleted,
deleted data, deleted by, etc.) are populated properly.
15. Check if input data is not truncated while saving. The field length shown to the user on the page and in
the database schema should be the same.
16. Check numeric fields with minimum, maximum, and float values.
17. Check numeric fields with negative values (for both acceptance and non-acceptance).
18. Check if the radio button and drop-down list options are saved correctly in the database.
19. Check if the database fields are designed with the correct data type and data length.
20. Check if all table constraints like Primary key, Foreign key, etc. are implemented correctly.
21. Test stored procedures and triggers with sample input data.
22. Input field leading and trailing spaces should be truncated before committing data to the database.
23. Null values should not be allowed for the Primary key column.

Test Scenarios for Image Upload Functionality

(Also applicable for other file upload functionality)


1. Check for the uploaded image path.
2. Check image upload and change functionality.
3. Check image upload functionality with image files of different extensions (For Example, JPEG, PNG,
BMP, etc.)
4. Check image upload functionality with images that have space or any other allowed special character in the
file name.
5. Check for duplicate name image upload.
6. Check the image upload with an image size greater than the max allowed size. Proper error messages
should be displayed.
7. Check image upload functionality with file types other than images (For Example, txt, doc, pdf, exe, etc.).
A proper error message should be displayed.
8. Check if images of specified height and width (if defined) are accepted or otherwise rejected.
9. The image upload progress bar should appear for large size images.
10. Check if the cancel button functionality is working in between the upload process.
11. Check if the file selection dialog only shows the supported files listed.
12. Check the multiple images upload functionality.
13. Check image quality after upload. Image quality should not be changed after upload.
14. Check if the user is able to use/view the uploaded images.
Test Scenarios for Sending Emails

(Test cases for composing or validating emails are not included here)
(Make sure to use dummy email addresses before executing email related tests)
1. The email template should use standard CSS for all emails.
2. Email addresses should be validated before sending emails.
3. Special characters in the email body template should be handled properly.
4. Language-specific characters (For Example, Russian, Chinese or German language characters) should
be handled properly in the email body template.
5. The email subject should not be blank.
6. Placeholder fields used in the email template should be replaced with actual values e.g. {Firstname}
{Lastname} should be replaced with an individual’s first and last name properly for all recipients.
7. If reports with dynamic values are included in the email body, report data should be calculated correctly.
8. The email sender’s name should not be blank.
9. Emails should be checked by different email clients like Outlook, Gmail, Hotmail, Yahoo! mail, etc.
10. Check to send email functionality using TO, CC and BCC fields.
11. Check plain text emails.
12. Check HTML format emails.
13. Check the email header and footer for the company logo, privacy policy, and other links.
14. Check emails with attachments.
15. Check to send email functionality to single, multiple or distribution list recipients.
16. Check if the reply to the email address is correct.
17. Check to send the high volume of emails.
Test Scenarios for Excel Export Functionality

1. The file should get exported with the proper file extension.
2. The file name for the exported Excel file should be as per the standards, For Example, if the file name is
using the timestamp, it should get replaced properly with an actual timestamp at the time of exporting the
file.
3. Check for date format if the exported Excel file contains the date columns.
4. Check the number formatting for numeric or currency values. Formatting should be the same as shown on
the page.
5. The exported file should have columns with proper column names.
6. Default page sorting should be carried out in the exported file as well.
7. Excel file data should be formatted properly with header and footer text, date, page numbers, etc. values
for all pages.
8. Check if the data displayed on the page and exported Excel file is the same.
9. Check export functionality when pagination is enabled.
10. Check if the export button is showing the proper icon according to the exported file type, For
Example, Excel file icon for xls files
11. Check export functionality for files with very large size.
12. Check export functionality for pages containing special characters. Check if these special characters are
exported properly in the Excel file.
Performance Testing Test Scenarios
1. Check if the page load time is within the acceptable range.
2. Check if the page loads on slow connections.
3. Check the response time for any action under light, normal, moderate, and heavy load conditions.
4. Check the performance of database stored procedures and triggers.
5. Check the database query execution time.
6. Check for load testing of the application.
7. Check for Stress testing of the application.
8. Check CPU and memory usage under peak load conditions.
Security Testing Test Scenarios
1. Check for SQL injection attacks.
2. Secure pages should use the HTTPS protocol.
3. Page crash should not reveal application or server info. The error page should be displayed for this.
4. Escape special characters in the input.
5. Error messages should not reveal any sensitive information.
6. All credentials should be transferred over to an encrypted channel.
7. Test password security and password policy enforcement.
8. Check the application logout functionality.
9. Check for Brute Force Attacks.
10. Cookie information should be stored in encrypted format only.
11. Check session cookie duration and session termination after timeout or logout.
11. Session tokens should be transmitted over a secured channel.
13. The password should not be stored in cookies.
14. Test for Denial of Service attacks.
15. Test for memory leakage.
16. Test unauthorized application access by manipulating variable values in the browser address bar.
17. Test file extension handling so that exe files are not uploaded or executed on the server.
18. Sensitive fields like passwords and credit card information should not have to be autocomplete enabled.
19. File upload functionality should use file type restrictions and also anti-virus for scanning uploaded files.
20. Check if directory listing is prohibited.
21. Passwords and other sensitive fields should be masked while typing.
22. Check if forgot password functionality is secured with features like temporary password expiry after
specified hours and security questions are asked before changing or requesting a new password.
23. Verify CAPTCHA functionality.
24. Check if important events are logged in log files.
25. Check if access privileges are implemented correctly.

You might also like