+ All Categories
Home > Documents > Final Mini

Final Mini

Date post: 05-Apr-2018
Category:
Upload: rithu-chand
View: 215 times
Download: 0 times
Share this document with a friend
72
A PROJECT REPORT ON (QUICK MESSENGER)  Submitted By:- 1. S.Rithika 07981A05C1 2. P.Lava nya 07981A05C1 Under The Guidance Of “Mr.G.Satees h  Dept. of COMPUTER SCIENCE & ENGINEERI NG RAGHU ENGINEERING COLLEGE  1
Transcript
Page 1: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 1/72

A

PROJECT REPORT ON

(QUICK 

MESSENGER)

 

Submitted By:-

1. S.Rithika 07981A05C1

2. P.Lavanya 07981A05C1

Under The Guidance Of 

“Mr.G.Sateesh ” 

Dept. of COMPUTER SCIENCE & ENGINEERING

RAGHU ENGINEERING COLLEGE

 

1

Page 2: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 2/72

ABSTRACT

Quick messenger is a utility which allows a group of users to communicate

among each other through electronic text messaging.

The chat system includes a chat server and plurality of chat clients in a network.

The main goal of the project is to reduce the burden on the

Chat server. The basic idea is that the chat server only negotiates the clients for 

communication without involving itself in the data transfer.

This application doesn’t require internet connection for communication.

A group of computers in a Local Area Network (LAN) are enough for utility.

When a user makes a request to chat server, the name and IP address of the user 

is kept in the server and the user get the lists of online users and their 

corresponding IP addresses. The user selects a name/IP address from the list to

communicate straightly without the participation of server.

The advantage is, even the server is stopped, and the communication

among the negotiated clients is not affected.

2

Page 3: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 3/72

 

EVALUATION SHEET

1. Title of Project: QUICK MESSANGER 

2. Year of Submission: 2011

3.  Name of The degree: B.Tech

4. Student Names:

• S.Rithika

• P.Lavanya

5.  Name of the Guide: Mr G.Sateesh

6. Result Approved/Rejected

Internal Examiner External Examiner 

Mr.S.Satyanarayana Mr/Mrs…………………

H.O.D OF C.S.E

3

Page 4: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 4/72

Contents

1. Introduction-------------------------------------------5

1 Feasibility Analysis-----------------------------------6

2.1 Economic Feasibility----------------------------6  2.2 Technical Feasibility----------------------------7

  2.3 Operational Feasibility-------------------------7

3 Requirement Analysis---------------------------------8

3.1 Existing system-----------------------------------8

4 Requirement specifications---------------------------94.1 Functional requirement-----------------------9

4.2 Non-functional requirement-----------------11

4.3 Goal of implementation-----------------------11

5 .System requirement specification----------------12

5.1 Hardware specification-----------------------12

5.2 Software specification-------------------------13

5.3 Software description (java features) ------13

6. Software Design---------------------------------------18

6.1 Generalised design approach----------------19

6.2 Use case model-----------------------------------19

6.3 Domain model------------------------------------22

6.4 Sequence diagram-------------------------------23

6.5 Class diagram------------------------------------27

7. Coding---------------------------------------------------28

8. Testing---------------------------------------------------65

8.1 Testing objectives--------------------------------65

8.2 Testing principles---------------------------------66

8.3 Testing strategies---------------------------------66

8.4 Types of testing------------------------------------66

9. Future development-----------------------------------70

`10. Conclusions---------------------------------------------71

11. Bibliography-------------------------------------------72

4

Page 5: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 5/72

1. Introduction

Establishing relation and maintaining communication is a vital part of everybody’s life. There

are so many ways and media through which people can communicate with each other. Some of 

the basic means of communication are voice, audio, video, picture, text etc. The most widely

used system among them is electronic messaging due to its inexpensiveness.

Quick messenger project is an afford to make the communication process cheaper and efficient

among people. To make the process less expensiveness, we need to use the devices of low

configuration, open sources and etc. To make the process more efficient, the message transfer 

delay must be reduced and some other factors like network bandwidth etc. must be taken care.

In order to achieve the above goals, the quick messenger utility is developed using java (an

open source).It involves both connection-less (UDP) and Connection-oriented services (TCP)of network. It is designed in such a manner that even a Pentium-pro machine can serve as a

server as well as a client. It closes the connections automatically whenever they are not

required.

2.Feasibility Analysis:

5

Page 6: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 6/72

 

2.1> Economic Feasibility

2.2> Technical Feasibility

2.3> Operational Feasibility

The aim of feasibility study is to determine whether developing the product is financially

and technically feasible. The feasibility study involves analysis of the problem and collection

of data which would be input to the system, the processing required to be carried out on these

data, the output data required to be produced by the system as well as study of various

constraints on the behaviour of the system. The collected data are analyzed to arrive at the

following:

• An abstract definition of the problem.

• Formulation of the different solution strategies.

• Examination of alternatives solution strategies and their benefits, indicating resources

required, development, cost and time in respect of each of the alternative solutions.

2.1.Economic Feasibility

  This is based on questions like “will the system provide benefits greater than the costs?”

.The feasibility study presents intangible as well as tangible benefits in a formal way. A

relatively detailed analysis of the costs of both development and operations of various

alternatives is also presented.

The project “Quick Messenger” is economically feasible in the following manner: 

The preliminary investigation is done with an affordable cost.

The charges of hardware and software implemented in this project are less costly.

This project hopes no costly errors arise in near future.

This project uses java which is a open source.

2.2. Technical Feasibility

6

Page 7: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 7/72

This is based on questions like” can the proposed application be implemented with existing

equipment, software technology and available personnel”. If the new technology is required,

what is the likelihood that it can be developed? Analysis of project risk relative to technical

feasibility includes not only whether the technology available on the market but also its “state

of the art” both in absolute terms and relative to company’s current technical specification.

The project “Quick Messenger” is technically feasible in the following manner:

The proposed system can run well in the existing system

The proposed system provides adequate responses to enquires regardless of the number 

or location of users.

The proposed system can be expanded if desired.

The proposed system provides guarantee in terms of accuracy, reliability, easy accessand data security.

Computers need to be connected to each other as there is a client-server system being

used in this project.

2.3. Operational Feasibility:

This is based on questions like “will the system be used if it is developed and implemented?

Will these be resistance from users that will undermine the possibility application benefits?”

This analysis may invoke a subjective assessment of political and managerial environment in

which the system will be implemented. In general the greater the requirements for change in the

user environment in which the system will be installed the greater the risk of implementation

failure.

The project “Quick Messenger” is operationally feasible in the following manner:

The proposed system would definitely be used if developed and implemented.

The proposed system has the facility to incorporate any kind of change put on it.

3. Requirement ANALYSIS

7

Page 8: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 8/72

System analysis is an activity that encompasses most of the tasks that are called computer 

system engineering. Analysis is a detailed study of various operations performed by a system.

Once analysis is completed, the analyst has firm understanding of what is done.

In other words, it’s a reduction of an entire by studying the various operations and their 

relationship within the system; an examination of business activity, with the overview of 

identifying the problem areas and recommending alternate solutions.

The objectives of the system analysis are

Identifying the needs

Analyzing the existing and proposed system

Evaluating the feasibility study

Perform economical and technical analysis

Identifying the hardware and software requirements

Allocating functions to hardware and software

Create a system definitions

3.1 EXISTING SYSTEM

The existing systems uses master-proxy-slave model to transfer messages. While transferring

messages, a large amount of time is wasted in transferring data from the master to the slaves,

 by various buffering.

The following problems are encountered while using the existing system.

Problems:

• Requires a high configuration machine to act as a server 

• Single point of failure(if server fails, the entire system fails)

• Bandwidth consumption is high

• Requires internet connection.

So we need to design a system for quick messaging which will eradicate the above problems.

8

Page 9: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 9/72

4. Requirement Specification.

Purpose: The purpose is to describe the external requirements for an on lone chatting system.

Overall Description:

This application is specifically designed for the college, JITM. The college has nearly 10,000

computers which are LAN connected. The IP addresses to all the systems are given by a DHCP

server. All the systems are behind a NAT router. They access internet through a proxy server.

This utility is to facilitate online instant messaging. Through a single computer, a person can

establish communication as many as computers he requires. When a user terminates, it must be

notified to all who are connected to him.

4.1 Functional requirements.

The system has following functional requirements.

R1:Login

Description: The login function is to connect the user to the server and to get the list of online

users who are logged in currently. The server stores information regarding currently logged in

users and passes them to clients when they request.

R1.1: connect to server 

Input: server IP and server-port

Output: user prompted to enter name.

R1.2: Enter name

Input: name

Output: set of online users

R2:Invite for chatting

Description: This function is to invite a selected user for chatting.

The user has to select an online user from the group of online users. This will open a chatwindow for message transfer. When one user closes the chat window, the window on the other side gets automatically closed.

R2.1: select an online user 

State: The user has logged in and the main menu containing the set of online users has been

displayed.

Input: a name selected from the list

9

Page 10: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 10/72

Output: a chat window appears for messaging.

R3: Continue Chatting

Description:  This function is to provide the user with message sending and accepting

capability. This sends a message to the destination as well as receives the message from other online users to a given system/node.

R3.1.send/receive message

State: The user has logged in, invited a online user for chatting and the window for chatting has

 been displayed

Input: message to be sent.

Output: the sent message along with received messages are displayed

R3.2.Terminate session

State: The user has logged in, invited a online user for chatting and the window for chatting has

 been displayed

Input: close option.

Output: Connection to remote user is terminated and the chatting window disappears.

R4: Logout

Description: This function is used to logout. A message is sent to the server to remove the

corresponding entry from the online user list.

R4:1: select close option

Input: close option

Output: The main window displaying online user list is disappeared.

4.2 Non Functional Requirements.

• It should take advantages of both TCP and UDP protocols.

• The burden on the server should be less. So a low-configuration machine can be used as

server for cost-effectiveness.

• Should take less time to transfer the messages.

• Even, the server fails, the link between established clients should not be affected

10

Page 11: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 11/72

• Should Work on both intranet and internet.

• It should support very large number of users.

4.3 Goals of Implementation:

Should be designed in such a manner that extrafeatures can be added in the later 

stages.

Code Must be reusable

Flexible and accurate.

 

5. System Requirement Specification

This is a process of determining the requirements of the new system. These requirements

should satisfy the needs of a client. The Requirements Analysis phase defines WHAT a systemmust do and the Design states HOW to do it.

11

Page 12: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 12/72

Requirements generally specify:-

• The operating system must be user-friendly and support multitasking with ease.

• Processing speed of the system shouldn’t deteriorate during execution.

• Security and protection should also be taken into consideration as any number of 

computers may be used for communication later on.

• The operating systems must be portable enough to meet the requirements of the user.

• Such an operating system must be opted which runs on more CPUs and platforms than

any other computer operating system

Hardware and software Requirements:

The minimum hardware and software needed on the client machine are as follows:

5.1. HARDWARE SPECIFICATIONS (minimum requirements):

1. PROCESSOR - Intel Pentium pro

2. RAM - 128 MB (For good performance)

3. HARDDISK - 5GB required

4. KEYBOARD (104 keys) - Standard

5. MOUSE -Standard

6. CABLES - RS232 cables

7. DISPLAY UNIT -Preferably a colour monitor 

5.2. SOFTWARE SPECIFICATIONS:

1. OPERATING SYSTEM - WINDOWS XP, Linux, Solarises

2. LANGUAGE - Java

3. TOOLS -Java Development kit (1.4)

5.3. Software Description (JAVA FEATURES)

The inventors of Java wanted to design a language which could offer solutions to some of the

 problems encountered in modern programming. They wanted the language not only to be not

12

Page 13: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 13/72

only reliable, portable and distributed but also simple, compact and interactive. Sun

Microsystems officially describes Java with the following attributes:

Compiled and Interpreted

Platform-Independent and Portable

Object-Oriented

Robust and Secure

Distributed

Familiar, Simple and Small

Multi threaded and Interactive

High Performance

Dynamic and Extensible

Although the above appears to be a list of buzzwords, they aptly describe the full potential of 

the language. These features have made java will also become the premier language for general

 purpose stand-alone applications.

5.3.1 Compiled and Interpreted

Usually a computer language is either compiled or interpreted or interpreted. Java combines

 both these approaches thus making java a two stage system. First, java compiler translates

source code into what is known as byte code instructions. Byte codes are not machine

instructions and therefore, in the second stage, java interpreter generates machine code that can

 be directly executed by the machines that is running the java program the java program. We

can thus say that java is both a compiled and interpreted language.

5.3.2 Platform-Independent and Portable

The most significant contribution of java over other languages is its portability. Java programs

can be easily moved from one computer system to another, anywhere and anytime. Changes

and upgrades in operating systems, processors and system resources will not force any changes

in Java programs. This is the why Java has become a popular language for programming on

Internet which interconnects different kinds of systems worldwide. We can download a java

applet from a remote computer onto our local system via Internet and execute it locally. This

makes the Internet an extension of the user’s basic system providing practically unlimited

number of accessible applets and applications.

13

Page 14: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 14/72

Java ensures portability in two ways. First, java compiler generates byte code instructions that

can be implemented on any machine. Secondly, the size of the primitive data types is machine-

independent.

5.3.3 Object-Oriented

Java is a true object-oriented language. Almost everything in java is an object all programs

code and data reside within objects classes. Java comes with an extensive set of classes,

arranged in packages that we can in our programs by inheritance. The object model in Java is

simple and easy to extend.

5.3.4 Robust and Secure

Java is a robust language .It provides many safeguards to ensure reliable code. It has strict

compile time and run time checking for data types. It is designed as a garbage-collected

language relieving the programmers virtually all memory management problems. Java alsoincorporates the concept of programmers virtually all memory management problems. Java also

incorporates the concept of exception handling which captures series errors and eliminates any

risk of crashing the system.

Security becomes an important issue for a language that is used for programming on Internet.

Threat of viruses and abuse of resources is everywhere. Java systems not only verify all

memory access but also ensure of resource is everywhere. Java systems not only verify all

memory access but also ensure that no viruses are communicated with applet. The absence of 

 pointers in Java ensures that programs cannot gain access to memory locations without proper 

authorization.

5.3.5 Distributed

Java is designed as a distributed language for creating applications on networks. It has the

ability to share data and programs. Java applications can open and access remote objects on

Internet as easily as they can do in a local system. This enables multiple programmers at

multiple remote to collaborate and work together on a single project.

5.3.6 Simple, Small and Familiar

Java is a small and simple language. Many features of C and C++ that are either redundant or 

sources of unreliable code are not part of java. For examples, java does not use pointers, pre-

 processor header files, statement and many others. It also eliminate operator overloading and

header files, go to statement and many others. It also eliminates operator overloading and

header multiple inheritance. For more detailed comparison of Java with C and C++.

Familiarity is another striking feature of Java. To make the language look familiar to the

existing programmers, it was modelled on C and C++ languages. Java uses many constructs of 

14

Page 15: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 15/72

C and C++ and therefore, Java code “looks like a C++” code. In fact, Java is a simplified

version of C++.

5.3.7 Multithreaded and interactive

Multithreaded means handling multiple tasks simultaneously. Java supports multithreaded programs. This means that we need not wait for the application to finish one task before

 beginning another. For example, we can listen to a audio clip while scrolling at the same time

download an applet from a distant computer. This feature greatly improves the interactive

 performance of graphical applications.

The Java runtime comes with tools that supports multiprocess synchronization and

construct smoothly running interactive systems.

5.3.8 High Performance

Java performance is impressive for an interpreted language, mainly due to the use of 

intermediate byte code. According to sun, Java speed is comparable to native C/C++. Java

architecture is also designed to reduce overheads during runtime. Further, the incorporation of 

multithreading enhances the overall execution speed of Java programs.

5.3.9 Dynamic and Extensible

Java is a dynamic language. Java is capable of dynamically linking new class libraries, methods

and objects. Java can also determine the type class through the class through a query, making it

 possible to either dynamically link or abort the program, depending on the response.

Java programs support functions written in other languages such as C/C++. These functions

are known as native methods. This facility enables the programmers to use the efficient

functions available in these languages. Native methods are linked dynamically at runtime.

5.3.10 GUI programming with Java

The Java programming language class library provides a user interface toolkit called the

Abstract Windowing Toolkit, or the AWT. The AWT is both powerful and flexible.

The AWT (Abstract Window Toolkit) has been present in all versions of Java

The AWT objects are built above native code objects, giving a native look-and-feel

The AWT objects are a least common denominator of all platforms

AWT classes are known as heavyweight classes. (uses peer classes)

Swing classes are known as lightweight classes. (doesn’t use peer classes)

Because the Java programming language is platform-independent, the AWT must also be

 platform-independent. The AWT was designed to provide a common set of tools for graphical

15

Page 16: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 16/72

user interface design that work on a variety of platforms. The user interface elements provided

 by the AWT are implemented using each platform's native GUI toolkit, thereby preserving the

look and feel of each platform. This is one of the AWT's strongest points. The disadvantage of 

such an approach is the fact that a graphical user interface designed on one platform may look 

different when displayed on another platform. A graphical user interface is built of graphicalelements called components. Typical components include such items as buttons, scrollbars, and

text fields. Components allow the user to interact with the program and provide the user with

visual feedback about the state of the program. In the AWT, all user interface components are

instances of class Component or one of its subtypes. Components do not stand alone, but rather 

are found within containers. Containers contain and control the layout of components.

Containers are themselves components, and can thus be placed inside other containers. In the

AWT, all containers are instances of class Container or one of its subtypes

5.3.11 GENERAL IDEA ABOUT SOCKETS

1. Sockets:

All references to sockets in this article are references to TCP/IP. A socket is a generalized inter-

 process communication channel. A socket is also a virtual communication conduct between

two processes, these processes may be local (residing on the same computer) or remote.

A socket is the combination of an IP address and a port number. Formally a socket is defined

 by a group of four numbers, these are the remote host identification number or address the

remote host port number The local host identification number or address The local host port

number.

2. TCP /IP:

TCP (Transmission Control Protocol) is sometimes also referred to as stream. TCP/IP includes

many protocols and many ways to communicate. The most common transports are TCP and

UDP. TCP is a connection-based protocol - that is, you must connect to a server before you can

send data - that guarantees delivery and accuracy of the data sent and received on the

connection. TCP also guarantees that data will arrive in the order that it's sent. Most things that

use TCP/IP use TCP for their transport.

3. Client:

A client is a process that initiates a connection. Typically, clients talk to one server at a time. If 

a process needs to talk to multiple servers, it creates multiple clients.

4. Server:

A server is a process that answers incoming requests. A typical server handles numerous

requests from many clients simultaneously. Each connection from the server to the client1.

5. IP Address:

16

Page 17: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 17/72

Each computer on a TCP/IP network has a unique address associated with it. Some computers

may have more than one address associated with them. An IP address is a 32-bit number and is

usually represented in dot notation, e.g. 192.168.0.1. Each section represents one byte of the

32-bit address.

6. Ports:

A port is an integer number that identifies which application or service the client wishes to

contact. When an application (a server) is ready to accept incoming requests, it begins to listen

on a port. This is why sometimes application or protocol is used interchangeably with the word

 port. When a client wants to talk to a server, it must know where the application is (the IP

address/phone number), and which port (extension) it's listening (answering) on. Typically,

applications have a fixed port so that no matter where they run, the port is fixed for that type of 

application.

6. Software Design

Software design deals with transferring the customer requirements ,as described in the SRSdocument ,into a form that is implementable using a programming language. For design to be

17

Page 18: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 18/72

easily implementable in a convenient programming language, the following items must bedesigned during design phase.

• Different modules required to implement the design solution

• Control relationship among the identified modules

• Interface among different modules .the interface among different modules identifies theexact data items exchanged among the modules.

• Data structure of individual modules

• Algorithm required to implement the individual modules

Thus, the objective of design phase is to take SRS document as the input and produce abovementioned documents before completion of the design phase.

We can broadly classify the design activities into two important parts.

•Highlevel design

• Detailed design

The first three activities as mentioned above comes under high level design and the remainingtwo activities comes under the detailed design.

Design Approaches.

There are fundamentally two different approaches to software design

Function-oriented design

Object-Oriented Design

Object-oriented Design(OOD)

OOD advocates a radically different approach compared to the function-oriented designapproach. In traditional design approaches all the functions that the system needs to supportshould first be identified and then implemented. In contrast, the OOD paradigms suggest thatthe natural objects occurring in a problem should first be identified and then implemented.

In OOD ,state information is not represented in a centralized shared memory but is distributed

among objects of the system. Function-oriented techniques, such as SA/SD, group the functionstogether if, as a group, they constitute a higher level function. On the other hand, the OODtechniques group the functions together on the basis of the data they operate on.

6.1 A Generalised object oriented analysis and design process.

18

Page 19: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 19/72

OOD analysis and design process is schematically shown in the figure.

6.2 USE CASE MODEL

The use case model for any system consists of a set of “use cases”.Intuitively,use casesrepresent different ways in which a system can be used by the users.Roughly speaking,the usecases corresponds to the high level requirements of the system.The use cases partition thesystem behaviour into transactions ,such that each transaction performs some useful actionfrom the user’s point of view.Each transaction involves either a single message exchange or multiple message exchanges between the user and the system to complete itself.The use casemodel the project “Quick messenger” is as follows.

19

Page 20: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 20/72

Text description

U1: Login: using this case, the user connects to the chat server and registers himself by providing necessary details. In turn, the user gets the name of all users.

Scenario 1: Main line sequence

User: enter server address.

System: display prompt to enter name.

User: enter the name.

System: display the set of online users.

Scenario 2:

At step (4) of the main line sequence.

 

2: system: invalid server ip.

20

Page 21: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 21/72

Scenario 3:

At step (4) of the main line sequence

  4: system: display message: user already exists.

U2: Invite Chat: using this use case, the user invites a online user for chatting.

Scenario 1: Main line sequence:

User: Refreshes the online user list and selects one online-user among them.

System: displays a chat-window for chatting.

U3: Chat: this use code is to send and receive message to and from an online user Respectively.

Scenario1: main line sequence:

User: types the messages and selects option.

System: sends the message to the destination.

Scenario2: at step-1 of main line sequence:

User: selects the close option.

System: closes the chat window and sends terminate message to destination.

21

Page 22: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 22/72

6.3 Domain Model

A domain model is a representation of the concepts or objects appearing in the problemdamain.It also captures the obivious relationship among these objects.Domain modeling is alsoknown as conceptual modeling.The objects identified during domain analysis

Can be classified into three categories.

• Boundary objects

• Entity Objects

• Controller Objects

The Boundary objects are those with which the actor interacts.The boundary objects are mainlyresponsible for user interaction.Therefore,they normally donot include any processing logic.

Entity objects normally holds information such as data tables and files that need to outlive usecase execution.

The controller object coordinate the activities of a set of entity objects and interface with the boundary objects to provide the overall behaviour of the system.

The Domain model of the project is shown as above.

6.4 Sequence diagram

MainAgentG

UI

CloneAgentG

UILoginGUI

MainAgent CloneAgent

Message

MainServer

22

Page 23: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 23/72

A sequence diagram shows interaction among objects as a two-dimensional chart.the chart isread from top to bottom.The objects participating in the interaction are shown at the top of thechart as a boxes attached to a vertical dashed line.The vertical dashed line is called the object’s

life line.The rectangle drawn on the life line is called activation symbol and indicates that theobject is active as long as the rectangle exists.Each message is indicated as an arrow betweenthe life lines of two objects.

Sequence Diagram for Login

 

Login

Login Info

Connect

[errconnection]

Show error

Show error

CheckDuplicate

Match*

[Duplicate]

Show error

Show errorIns

ert

Online user set

Display user set

Disconnect

23

: LoginGUI : :Main : Hash

Page 24: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 24/72

 

Sequence Diagram for Refresh and

Logout

 

Refresh/Logout

Refresh/Logout

Connect

  [DisConnect]

Show error

Show error

[Refresh]

Refre

sh

User List

User List

Display user set

[Logout]

Delete

user

Disconnect

24

: : : : Hash

Page 25: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 25/72

 

Sequence Diagram for invite chat

 

NVITE

Invite

Create

 

connect

[connect]

create 

25

: : MainAgent: Remote

MainAgent

 

:

:RemoteCLoneAgen t 

Page 26: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 26/72

Sequence Diagram for Chat

 

Sent

Sent message*

Message*

DisplayMessage

*

Sent

sentmessage*

Message*Displaymessage*

Terminate

Terminate

Close Terminate

close

26

:: Clone

Agent: Remote

Clone Agent:

CLoneA entGUI

Page 27: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 27/72

6.5 Class Diagram

A class diagram describes the static structure of a system. It shows how a system is structuredrather than how it brhaves.The main constituent of class diagram classes and their relationships: generalization, aggregation, association and various kinds of dependencies.

* * *

27

Main Agent

GUI

LogInGUI  CloneAgentGU

I

Main Agent

DatagramSocket

DatagramPacket

ConnectToMainserver()

Receive ()

CreateCloneAgent()

Message

Name

Action

Text

GetName ()

SetName ()

GetAction ()

Set Action ()

GetMessage ()

SetMessage ()

Clone

Agent

Datagram

Socket

Datagram

Packet 1

Datagram

Packet 2

Receive ()

Send Data ()

Page 28: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 28/72

 

7. CODING

Input and Output System Design

Screen Slots of Project

 First When We will execute the Program by typing java LoginGUI, Figure-1 appears

28

Page 29: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 29/72

In the text box, the user need to type the server-ip address.( figure-2).Or else

one can enter the name of the computer in which the server is running.(as

figure-3).

The code corresponding to above GUI is as follows.

//file name: LoginGUI.java

import java.io.*;

import java.net.*;

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

 public class LoginGUI extends Frame implements ActionListener 

{

TextField serverIP;

Button ok;

DialogMsg d1;

DialogInput d2;

 public LoginGUI()

{

super("user login for chatting");

setSize(200,150);

setResizable(false);

setBackground(Color.lightGray);

29

Page 30: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 30/72

setLayout(new FlowLayout());

serverIP=new TextField(16);

ok=new Button(" Ok ");

d1=new DialogMsg(this);

d2=new DialogInput(this);

add(new Label("Server IP:"));

add(serverIP);

add(new Label(" "));//to add a blank line

add(ok);

ok.addActionListener(this);

MyWindowHandler handle=new MyWindowHandler(this);

addWindowListener(handle);

setVisible(true);

}

 public void actionPerformed(ActionEvent ae)

{

int sport=0,cport=0;

if(ae.getSource()==ok)

{

setVisible(false);

d2.setMsg("enter a name by which u want to chat");

MainAgentGUI jkl=new

MainAgentGUI(serverIP.getText(),d2.getText());

}

30

Page 31: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 31/72

}

 public static void main(String args[])

{

new LoginGUI();

}

}

After entering the serverIP, Figure-1 appears. The user need to enter a name by

which he will be known to all other online users. If the name field is left blank,figure-3 appears as a message.

The coding for the below output are as shown below.

31

Page 32: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 32/72

File name:DialogInput.java

mport java.awt.*;

mport java.awt.event.*;

ublic class DialogInput extends Dialog implements ActionListener 

Label msg;

TextField text;

Button ok;

String str;

DialogMsg d1;

Frame frm;

 public DialogInput(Frame s)

{

super(s,"Message",true);

//setBackground(Color.blue);

//setForeground(Color.white);

setFont(new Font("Symbol",Font.BOLD,15));

frm=s;

msg=new Label("");

ok=new Button(" ok ");

//ok.setBackground(Color.blue);

//ok.setForeground(Color.white);

text=new TextField(20);

//text.setBackground(new Color(0x0000bb));

32

Page 33: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 33/72

//text.setForeground(Color.white);

setLayout(new FlowLayout());

setSize(350,150);

add(msg);

//add(new Label(" "));

add(text);

add(ok);

ok.addActionListener(this);

d1=new DialogMsg(frm);

}

 public String getText()

{

return(str);

}

 public void setMsg(String s)

{

msg.setText(" "+s);

setVisible(true);

}

 public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==ok)

33

Page 34: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 34/72

{

if(text.getText().equals(""))

d1.setText("you must need to enter a valid name ");

else{

setVisible(false);

str=text.getText();

}

}

}

File name:DialogMsg.java

mport java.awt.*;

mport java.awt.event.*;

ublic class DialogMsg extends Dialog implements ActionListener 

Label msg;

Button ok;

 public DialogMsg(Frame s)

{

super(s,"Message",true);

setFont(new Font("Symbol",Font.BOLD,15));

//setBackground(Color.blue);

34

Page 35: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 35/72

//setForeground(Color.white);

msg=new Label("");

ok=new Button(" ok ");

//ok.setBackground(Color.blue);

//ok.setForeground(Color.white);

setLayout(new FlowLayout());

setSize(350,100);

add(msg);

add(ok);

ok.addActionListener(this);

}

 public void setText(String str)

{

msg.setText(" "+str+" ");

setVisible(true);

}

ublic void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==ok)

setVisible(false);

}

35

Page 36: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 36/72

After typing the name, the figure -1 appears. It contains the list of current users.

elect a online user to chat (as shown in figure-2).The coding for above output is as shownelow.

file name:MainAgentGUI.

mport java.awt.*;

mport java.awt.event.*;

mport java.io.*;

mport java.util.*;

mport java.net.*;

ublic class MainAgentGUI extends Frame implements ActionListener 

java.awt.List users;

36

Page 37: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 37/72

TextField name;

Button find,refresh;

Panel p;

MyWindowHandler handle;

MainAgent magent;

 public MainAgentGUI(String IP,String name1)

{

setSize(280,380);

setTitle(name1);

setResizable(false);

setFont(new Font("Symbol",Font.BOLD,20));

setBackground(new Color(0xcccccc));

//setForeground(Color.yellow);

setLayout(new FlowLayout());

add(new Label("List of online users"));

users=new java.awt.List(10,false);

 p=new Panel();

name=new TextField(20);

name.setBackground(new Color(0xeeeeee));

users.setBackground(new Color(0xeeeeee));

//users.setForeground(Color.cyan);

users.setFont(new Font("Symbol",Font.BOLD,15));

setFont(new Font("Symbol",Font.BOLD,15));

find=new Button(" Find ");

37

Page 38: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 38/72

find.setBackground(new Color(0xdddddd));

refresh=new Button(" Refresh List ");

refresh.setBackground(new Color(0xdddddd));

add(users);

//add(new Label(" "));

 p.add(name);

 p.add(find);

add(p);

add(new Label(" "));

add(refresh);

handle=new MyWindowHandler(this);

users.addActionListener(this);

find.addActionListener(this);

refresh.addActionListener(this);

addWindowListener(handle);

magent=new MainAgent(IP,name1);

addUsers(magent.hstable);

setVisible(true);

}

//****************************************************************//

38

Page 39: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 39/72

public void addUsers(Hashtable hstable)

{

users.removeAll();

Enumeration enm=hstable.keys();

while(enm.hasMoreElements())

users.add((String)enm.nextElement());

}

 public void dispose()

{

magent.connectToMainServer("DELETE");

System.exit(0);

//block for connection termination

}

 public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==users)

{

String str=users.getSelectedItem();

System.out.println("double clicked "+str);

magent.createCloneAgent(str);

}

if(ae.getSource()==find)

39

Page 40: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 40/72

{

int i=search(name.getText());

if(i!=-1)

users.select(i);

else

name.setText("not found");

}

if(ae.getSource()==refresh)

{

magent.connectToMainServer("REFRESH");

addUsers(magent.hstable);

}

}

* public static void main(String[] args)

{

new UserList();

System.out.println("Hello World!");

}*/

rivate int search(String str)

{

int k=users.getItemCount();

40

Page 41: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 41/72

for(int i=0;i<k ;i++ )

if(str.equalsIgnoreCase(users.getItem(i)))

return(i);

return(-1);

}

After inviting a online user for chatting,the above windows are displayed to the

sers(involved chatting).

he code is as follows.

mport java.awt.*;

mport java.awt.event.*;

41

Page 42: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 42/72

mport java.net.*;

mport java.io.*;

public class CloneAgentGUI extends Frame implements ActionListener 

{

TextArea allMessage;

TextArea sentMessage;

Button send;

Thread threadR;

CloneAgent cgnt;

public CloneAgentGUI(String address,String name)throws

Exception

{

MyWindowHandler handle=new MyWindowHandler(this);

Keyhandler khandle=new Keyhandler();

addKeyListener(khandle);

setSize(280,400);

setBackground(Color.gray);

setForeground(Color.blue);

setResizable(false);

setLayout(new FlowLayout());

allMessage=new

TextArea("",10,30,TextArea.SCROLLBARS_VERTICAL_ONLY);

allMessage.setEditable(false);

allMessage.setBackground(new Color(0xdddddd));

//allMessage.append("");

42

Page 43: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 43/72

sentMessage=new

TextArea("",5,30,TextArea.SCROLLBARS_VERTICAL_ONLY);

sentMessage.setBackground(new Color(0xdddddd));

send=new Button(" send ");

setFont(new Font("Symbol",Font.BOLD,12));

add(new Label("********Chat Utility*******"));

add(allMessage);

add(new Label("

));

add(sentMessage);

add(send);

setVisible(true);

send.addActionListener(this);

sentMessage.addKeyListener(khandle);

addWindowListener(handle);

setVisible(true);

cgnt=new CloneAgent(address,name);

threadR=new Receive();

threadR.start();

}

public void dispose()

{

43

Page 44: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 44/72

// System.out.println("uma is great");

try{

cgnt.sendData("","stop");

}

catch(Exception e)

{

e.printStackTrace();

}

super.dispose();

}

************************************************************************

*****************************/

public void actionPerformed(ActionEvent ae)

{

try{

if(ae.getSource()==send)

{

allMessage.append("\nme: "+sentMessage.getText());

cgnt.sendData(sentMessage.getText(),"continue");

sentMessage.setText("");

}

}

catch(Exception e)

{

44

Page 45: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 45/72

e.printStackTrace();

}

}

* public static void main(String[] args)

{

new ClientInterface();

System.out.println("Hello World!");

}*/

************************************************************************

**************/

lass Receive extends Thread

{

ublic void run()

{

while(true)

{

try{

 byte data[]=new byte[500];

DatagramPacket receive=new DatagramPacket(data,data.length);

gnt.socket.receive(receive);

tring str=new String(receive.getData());

Message m=Message.fromString(str);

45

Page 46: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 46/72

f("stop".equals(m.getAction())){System.out.println("close");break ;}

llMessage.append("\n"+m.getName()+">>"+m.getMessage());

etTitle("reciver:"+m.getName());

gnt.sendpacket=receive;

}//try

catch(Exception e)

{

e.printStackTrace();

}

}//while

}//run

//Receive

************************************************************************

***************************/

lass Keyhandler extends KeyAdapter 

 public void keyTyped(KeyEvent ke)

{

try{

if(ke.getKeyChar()=='\n')

{

allMessage.append("\nme: "+sentMessage.getText());

46

Page 47: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 47/72

cgnt.sendData(sentMessage.getText(),"continue");

sentMessage.setText("");

}

}

catch(Exception e)

{

}

}

************************************************************************

********************************/

ublic static void main(String args[])throws Exception

{

CloneAgentGUI cf=new CloneAgentGUI(args[0],args[1]);

}

File name:Message.java

import java.io.*;

 public class Message implements Serializable

47

Page 48: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 48/72

{

 private String uname;

 private String action;

 private String message;

 public Message(String name,String act)

{

uname=name;

action=act;

}

String getName()

{

return(uname);

}

String getAction()

{

return(action);

}

String getMessage()

{

return(message);

}

void setMessage(String s)

{

message=new String(s);

48

Page 49: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 49/72

}

void setName(String s)

{

uname=s;

}

void setAction(String s)

{

action=s;

}

 public String toString()

{

return(uname+"#~$%"+action+"#~$%"+message);

}

 public static Message fromString(String s)

{

int i;

i=s.indexOf("#~$%");

Message k=new Message("","");

k.setName(s.substring(0,i));

s=s.substring(i+4);

i=s.indexOf("#~$%");

k.setAction(s.substring(0,i));

s=s.substring(i+4);

49

Page 50: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 50/72

k.setMessage(s);

return(k);

}

}

file CloneAgent.java

import java.net.*;

import java.io.*;

 public class CloneAgent

{

Message msg;

DatagramSocket socket;

DatagramPacket sendpacket;

public CloneAgent(String address,String name)throws Exception

{

msg=new Message(name,"");

int i=address.indexOf(":");

String IP=address.substring(0,i);

String port=address.substring(i+1);

Message m=new Message(name,"CONNECT");

50

Page 51: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 51/72

 byte data[]=m.toString().getBytes();

socket=new DatagramSocket();

sendpacket=new

DatagramPacket(data,data.length,InetAddress.getByName(IP),Integer.parseInt(

 port));

sendData("","START");

}

 public void sendData(String str,String act)throws Exception

{

msg.setAction(act);

msg.setMessage(str);

 byte data[]=msg.toString().getBytes();

sendpacket.setData(data);

socket.send(sendpacket);

}

}

file CloneAgent.java

import java.awt.*;

import java.awt.event.*;

import java.io.*;

51

Page 52: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 52/72

import java.util.*;

import java.net.*;

public class MainAgent

{

 public Hashtable hstable;//to store all online users

DatagramSocket dsocket;

String serverIP,uname;

int cport=8888;

Frame stp;

 public MainAgent(String IP,String name1)

{

serverIP=IP;

uname=name1;

stp=new Frame("");

while(openSocket());

while(!connectToMainServer("INSERT"));

}

 private boolean openSocket()

{

try{

dsocket=new DatagramSocket(cport);

52

Page 53: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 53/72

new ReceiveData(dsocket,uname).start();

return(false);

}

catch(Exception e)

{

cport=cport+1;

return(true);

}

}

 public void createCloneAgent(String str)

{

try

{

//new ClientInterface((String)hstable.get(str),cfg.getname());

Runtime r=Runtime.getRuntime();

Process p=r.exec("java CloneAgentGUI "+(String)hstable.get(str)

+" "+uname);

new Dthread(p).start();

}

catch(Exception e){e.printStackTrace();}

}

53

Page 54: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 54/72

 public boolean connectToMainServer(String action)

{

Socket con;

ObjectInputStream input;

ObjectOutputStream output;

Message msg;

try{

con=new Socket(serverIP,9999);

output=new ObjectOutputStream(con.getOutputStream());

output.flush();

input=new ObjectInputStream(con.getInputStream());

msg=new Message(uname,action);

msg.setMessage(""+cport);

output.writeObject(msg);

output.flush();

Object obj=input.readObject();

if(obj instanceof Message)

{

System.out.println("of type Message");

DialogMsg d=new DialogMsg(stp);

d.setText(" already exists.try another name");

54

Page 55: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 55/72

System.exit(0);

return(false);

}

if(obj instanceof Hashtable)

{

System.out.println("of type hashtable");

hstable=(Hashtable)obj;

return(true);

}

}

catch(UnknownHostException e)

{

DialogMsg d1=new DialogMsg(stp);

//setVisible(false);

d1.setText(" invalid serverIP ");

System.exit(0);

}

catch(SocketException e)

{

DialogMsg d1=new DialogMsg(stp);

//setVisible(false);

d1.setText(" invalid server PORT ");

System.exit(0);

55

Page 56: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 56/72

}

catch(Exception e)

{

e.printStackTrace();

DialogMsg d1=new DialogMsg(stp);

//setVisible(false);

d1.setText(" an exception occured ");

System.exit(0);

}

return(false);

}

}

//file Dthread.java

import java.io.*;

class Dthread extends Thread

{

Process prp;

Dthread(Process p)

{

 prp=p;

56

Page 57: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 57/72

}

 public void run()

{

try{

InputStreamReader ir=new InputStreamReader(prp.getInputStream());

BufferedReader br=new BufferedReader(ir);

System.out.println(br.readLine());

 prp.destroy();

}

catch(Exception e)

{

e.printStackTrace();

}

}

}

MyWindowHandler.java

import java.awt.*;

import java.awt.event.*;

 public class MyWindowHandler extends WindowAdapter 

{

 private Window s;

57

Page 58: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 58/72

 public MyWindowHandler(Window k)

{

s=k;

}

 public void windowClosing(WindowEvent we)

{

s.dispose();

}

}

SERVER program.

MainServer.java

import java.net.*;

import java.io.*;

import java.util.*;

 public class MainServer 

{

ServerSocket srvsocket;

Hashtable users;

 boolean status;

MainServer()

{

try{

58

Page 59: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 59/72

srvsocket=new ServerSocket(9999,100);

status=false;

users=new Hashtable();

}

catch(Exception e)

{

e.printStackTrace();

}

}

 public void runServer()

{

Socket s;

try{

while(true)

{

s=srvsocket.accept();

//System.out.println("connection established");

new ClientHandle(s,users).start();

}

}

59

Page 60: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 60/72

catch(Exception e)

{

e.printStackTrace();

}

}

 public static void main(String[] args)

{

System.out.println(">>CHAT SERVER STARTED..................");

new MainServer().runServer();

System.out.println("Hello World!");

}

}

ClientHandle.java

import java.io.*;

import java.net.*;

import java.util.*;

 public class ClientHandle extends Thread

{

Socket client;

ObjectInputStream input;

ObjectOutputStream output;

String IPadd;

60

Page 61: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 61/72

Message msg;

 public static Hashtable users;

//public static Daemon;

 public ClientHandle(Socket s,Hashtable k)

{

users=k;

try{

client=s;

input=new ObjectInputStream(client.getInputStream());

output=new ObjectOutputStream(client.getOutputStream());

IPadd=client.getInetAddress().getHostAddress();

System.setOut(new PrintStream(new

FileOutputStream("c:\\chatServer.log",true)));

System.out.print(IPadd+" ");

Date dt=new Date();

System.out.print(dt.toString()+" ");

}

catch(Exception e)

{

e.printStackTrace();

}

}

 public void run()

{

61

Page 62: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 62/72

try{

msg=(Message)input.readObject();

if(msg.getAction().equals("INSERT"))

insert();

else if(msg.getAction().equals("REFRESH"))

refresh();

else if(msg.getAction().equals("DELETE"))

delete();

client.close();

}

catch(Exception e)

{

e.printStackTrace();

}

}

synchronized private void insert() throws Exception

{

String name=msg.getName();

if(users.containsKey(name))

output.writeObject(msg);

else

{

users.put(name,IPadd+":"+msg.getMessage());

62

Page 63: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 63/72

System.out.println(IPadd+":"+msg.getMessage());

System.out.println(name+":logged In");

output.writeObject(users);

}

output.flush();

}

 private void refresh() throws Exception

{

output.writeObject(users);

System.out.println(msg.getName()+":Refreshed");

output.flush();

}

 private void delete()throws Exception

{

users.remove(msg.getName());

output.writeObject(users);

System.out.println(msg.getName()+":logged Out");

output.flush();

}

63

Page 64: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 64/72

}

When the User enters wrong serverIp, the above sequence of operations takes place.

 

64

Page 65: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 65/72

8. TESTING

8.1 TESTING OBJECTIVES:

1. Testing is a process of executing a program with the intent of finding an error.

2. A good test case is one that has a probability of finding an as yet undiscovered error.

3. Testing is a critical element of quality assurance.

4. Represents the ultimate review of specification, design and coding.

5. Testing presents an interesting anomaly for the software engineer.

8.2 TESTING PRINCIPLES:

All tests should be traceable to end user requirements.

Tests should be planned long before testing begins.

Testing should begin on a small scale and progress towards testing in large.

8.3 TESTING STRATEGIES

A Strategy for software testing integrates software test cases into a series of well planned

steps that result in the successful construction of software. Testing is a broader topic for 

what is referred to as Verification & Validation.

• Verification refers to the set of activities that ensure that the software correctly

implements a specific function.

65

Page 66: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 66/72

• Validation refers the sets of activities that ensure that the software has been built is

traceable to customer’s requirements.

8.4 Types of testing

Software products are normally tested at the individual component (or unit level).This isreferred to as testing in the small. After testing components individually, the components are

slowly integrated and tested at each level of integration  (integration testing).finally the fully

integrated system is tested (called system testing).Integration and system testing are known as

testing in the large.

Thus a software product goes through following levels of testing:

8.4.1 > Unit testing

8.4.2> Integration testing

8.4.3> System testing

8.4.1 Unit Testing

Unit testing focuses verification effort on the smallest unit of design that is the module. The

unit test is normally white box testing oriented & the step can be conducted in parallel for 

multiple modules. Here the divided modules can be individually tested through the working of 

the functions mentioned.

BLACK –BOX TESTING

In black-box testing, test cases are designed from an examination of the input/output valuesonly and no knowledge of design or code is required. The following are two main approaches

to design the black-box testing test cases.

• Equivalence class partitioning

• Boundary value analysis

Equivalence Class Partitioning

In this approach, the domain of input values to a program is partitioned into a set of 

equivalence classes. This partitioning is done such that the behaviour of the program is similar 

66

Page 67: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 67/72

every input data belonging to the same equivalence class. The main idea behind defining the

equivalence class is that testing the code with any one value belonging to an equivalence class

is as good as testing the software with any other value belonging to that equivalence class.

Equivalence classes for software can be designed by examining both input and the output data.

Boundary Value Analysis

A type of programming error frequently occurs in the boundaries of different equivalence

classes of inputs. The reason behind such errors might purely be due to psychological factors.

Programmers often fail to see the special processing required by the input values that lie at the

 boundary of different equivalence classes. Boundary value analysis leads to selection of test

cases at the boundaries of different equivalence classes.

 

WHITE BOX TESTING

White box testing sometimes called as glass box testing is a test case design method that uses

the control structures of the procedural design to derive test cases. Using white box testing

methods, the software engineer can derive test case that,

Guarantee that all independent paths with in a module have been exercised at least once

Exercise all logical decisions on their true and false sides

Execute all loops at their boundaries and within their operational bounds

Exercise internal data structures to ensure their validity.

Logic errors and incorrect assumptions are inversely proportional to the probability that

a program path will be executed.

Errors tend to creep into our work when we design and implement functions, conditions are or 

control that are out of the mainstream. Everyday processing tends to be well understood, while

special case processing tends to fall into the cracks. We often believe that a logical path is not

executed when, in fact, it may be executed on a regular basis. The logical flow of a

program is sometimes counterintuitive, meaning that our unconscious assumptions about

flow of control and data may lead us to make design errors that are uncovered only once path

testing commences.

8.4.2 INTEGRATION TESTING

The primary object of integration testing is to test the module interfaces in order to ensure that

there are no errors in the parameter passing, when one module invokes another module. During

testing, different modules of a system are integrated in a planned manner using an integration

67

Page 68: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 68/72

 plan. The integration plan specifies the steps and the order in which are combined to realize the

full system. After each integrated step, the partially integrated system is tested.

Anyone (or a mixture) of the following approches can be used to devlop the test plan.

Big -bang approach.

It is the simplest integration testing approach, where all the modules making up a system are

integrated in a single step.

Top-down approach.

Top-down integration testing starts with the main routine and one or two subordinate

routines in the system. After the top-level ‘skeleton’ has been tested, the immediate subroutines

of the ‘skeleton’ are combined with it and tested.

Bottom –up approach.

In bottom-up testing, each subsystem is tested separately and then the full system is tested. A

subsystem might consist of many modules which communicate among each other through well-

defined interfaces.

Mixed approach.

A mixed (also called sandwiched) integration testing follows a combination of top-down and

 bottom-up testing approaches.

Systems tests are designed to validate a fully developed system to assure that it meets its

requirements. There are essentially three main kind of system testing:

• Alpha testing. Alpha testing refers to the system testing carried out by the test team

within the developing organization.

• Beta testing. Beta testing is the system testing performed by a select group of friendly

customers.

Acceptance testing. Acceptance testing is the system testing performed by the

customer to determine whether to accept or reject the delivery of the system.

8.4.3 Performance testing

Performance testing is carried out to check whether the system meets the non-functional

requirements identified in the SRS document. There are several types of performance testing as

discussed below. The type of performance testing to be carried out on a system depends on the

different non-functional requirements of the system documented in the SRS document. All

 performance tests can be considered as black- box tests.

68

Page 69: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 69/72

Stress testing:

Stress testing evaluates system performance when it is stressed for short periods of time.

Stress tests are black-box tests which are designed to impose a range of abnormal and even

illegal input conditions so as to stress the capabilities of the software.

Volume testing:

It is especially important to check whether the data structures (arrays, queues, stacks, etc.) have

 been designed successfully for extra ordinary situations. For example, a compiler might be

tested to check whether the symbol table overflows when a very large program is compiled.

Configuration testing:

Configuration tasting is used to analyze system behavior in various hardware and software

configurations specified in the requirements. Sometimes systems are built in variable

configurations for different users

Usability testing:

This testing pertains to check the user interface to see if it meets all the user requirements.

During usability testing, the display screens, messages, report formats, and other aspects

relating to the user interface requirements are tested.

69

Page 70: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 70/72

8. FUTURE DEVELOPMENT

  The above documented application can be further enhanced in future in many ways.

• Implementing File transfer application.

• Voice communication facility

• Detecting online-clients automatically

• Establishing connection to server automatically.

70

Page 71: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 71/72

10. CONCLUSION

Thus the project entitled “quick messenger” has been successfully designed and implemented.

The project is designed, tested and finally implemented in a systematic manner. It is also found

that the project suits the needs of the company in all aspects.

In already existing system the system failed to perform the various task. And the performanceof the system was very poor. Which is been rectified over here.

At every phase of the project development, the feasibility study was done using the system

flow diagram. Also data control flow validation was done to ensure the reliability of software

and to conform the need and utility of software. This software can be extended and enlarged

with a little effort to make it possible to world for all other departments.

 

71

Page 72: Final Mini

8/2/2019 Final Mini

http://slidepdf.com/reader/full/final-mini 72/72

11. Bibliography

• Deitel & Deitel,” How to Program – Java”, Third Edition, Pearson Education(2000)

• R.K Selva Kumar “Java Programming “, Fourth Edition, N.V Publication.

• David Reilly & Michael Reilly “Distributed Computing and Java

•  Networks” Addison-Wesley Professional.

• http://pandonia.canberra.edu.au/ClientServer/socket/socket.html

• Search for Socket Programming in www.google.com

• Search in wikipedia.org

• Fundamentals Of Software Engineering,2nd Edition , Rajib Mall, PHI

 


Recommended