ST Lab FINAL
ST Lab FINAL
COLLEGE OF ENGINEERING
TRICHY - 621 105.
http:// www.mamce.org
BONAFIDE CERTIFICATE
is
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.
4) Define Error.
An error is mistake or misconception or misunderstanding on the part of a software
developer.
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.
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.
A Test is a group of related test cases, or a group of related test cases and test procedure.
A group of related tests that are associated with a database, and are usually run
together, is sometimes referred to as a Test Suite.
Quality relates to the degree to which a system, system component, or process meets
specified requirements.
(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.
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.
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.
A path is a sequence of control flow nodes usually beginning from the entry node of a
graph through to the exit node.
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.
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.
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.
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?
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.
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.
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.
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.
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
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.
(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.