You are on page 1of 31

PLACEMENT MOCKTEST

Abstract
Placement mocktest System is designed for Private Institutes to conduct tests of hiring their employees on a regular basis. The purpose of Placement mocktest is to take online test in an efficient manner and no time wasting for checking the paper. The system handles all the operations and generates reports as soon as the test is completed which saves the precious time of HR to spent on reviewing answer sheets. The existing system is weak when it comes to surprise test organizations whereas this system can make it possible very easily. To make the examination process in the organization fast, reliable, and error free. Questions can have multiple levels and multiple options, multiple answers or can be text answers to allow faculty to create sections. Sections can be timed, sections can have individual question timed, and each question in a section can have one mark. Hosting on the Intranet can provide a secured Examination channel for any organizational. Once the user registration can be done, the user successfully attends the exam. The database is self explanatory as the code. Create a Web application to be used for examination process by using JAVA, JSP AND MY SQL Server technology to create strong and secured database connectivity and instructions are also given. The main objective of Placement mocktest is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results.

2.1 Organizational Profile


Adroit solutions is a Offshore set up company Head quartered in Bangalore, Karnataka with a Branch office in Salem, Tamilnadu, India. Adroit Solutions, one of Indias reputed software development and business process out sourcing company provides Complete IT Solutions, Data Entry Services, to organizations from all the domains. Adroit Solutions is run by a Group of well experienced professionals are strive to achieve and solve the clients requirements at all levels in providing software solutions. Our professionals have a vast expertise in the field of Information Technology, these include services for application development, and management in the legacy, client-server, web and wireless technologies, integration solutions, data warehousing solutions, and testing services. Adroit provides clients with back office services that enable corporations to free up valuable resources for critical core functions. Adroits goal is to service the needs of clients by providing material improvements and substantial cost savings to the back-office functions that are critical to an organizations success. Adroits clients range from small clients with fewer than 100 employees all the way up to and including top rung companies. No client engagement is too small or too large for Adroit and its seasoned staff. Adroit is the world's leading provider of commercial open source customer relationship management (CRM) software for companies of all sizes. Adroit easily adapts to any business environment by offering a more flexible, cost-effective alternative than proprietary applications. Adroit architecture allows companies to more easily customize and integrate customerfacing business processes in order to build and maintain more profitable relationships. Adroit offers several deployment options, including on-demand, on-premise and appliance-based solutions to suit customers' security, integration and configuration needs. Corporate training As a part of our strategy, we have made an advent into corporate training, through which we train the in-house employees of a corporate house, and enable them to be abreast of the latest technological developments in their respective domains. Corporate Vision:

One main objective of Adroit Solutions is to provide world-class IT services for organizations through innovative and cost effective technology that delivers competitive advantages and increased profitability for our clients and business partners. Adroit Solutions have the ability to architect, develop and maintain any complex Software applications, cutting across technologies. We are pioneers in tapping the immense potential lying in the open source domain. Adroit Solutions deliver customer friendly Services that are on par with international standards in timely Execution of projects with precision. Our Quality Policy: Adroit Solutions is tuned to provide a complete IT solution and services for our customers meeting their requirements and satisfying them with a total quality output.

MODULES
The online exam has following modules Login Test Result Login: There is a quality login window because this is more secure than other login forms as in a normal login window there are multiple logins available so that more than one person can access to test with their individual login. But in this project there is only one login id. Hence it is more secure and reliable than previously used on-line exams. TEST: Test page is the most creative and important page in this project. It has options to select your level to write the exam. From the given choices the candidate can select his level (like quantitative aptitude, english and technical) for taking on with the test. It has the option of back to the question afterwards if needed. RESULT: Once you click the finish button your test will be finished. After you get your result in percentage of marks also it gives the list of attempted and unattempted questions. And you have a option to view your wrong answer questions in red color if you click that question no you will get question and correct answer your answer.

System Configuration
Software Requirements:
Language: Java, JavaScript Framework: MVC I Technology: Jsp, Servlet Build Tool: Apache Ant 1.7.0 Database: MySql 5.0 Web Server: Tomcat 5.5

Hardware Requirements:
Processor

: pentiumIV : 550MHz : 40GB : 128MB : 512KB

Clock speed
Hard Disk

RAM Cache Memoy

Operating System : windows XP Monitor Keyboard Mouse : Color Monitor : 104Keys : 3Buttons

3. System Study
EXISTING SYSTEM
The whole process of assigning test and evaluating their scores after the test, was done manually till date. Processing the test paper i.e. checking and distributing respective scores used to take time when the software was not installed. It is very difficult to analyze the exam manually. To take exam of more candidates more invigilators are required but no need of invigilator in case of on line exam.

PROPOSED SYSTEM
The Placement mocktest created for taking online test has following features In comparison to the present system the proposed system will be less time consuming and

is more efficient. Analysis will be very easy in proposed system as it is automated


Result will be very precise and accurate and will be declared in very short span of time

because calculation and evaluations are done by itself.


The proposed system is very secure as no chances of leakage of question paper as it is

dependent on the administrator only.

DATA FLOW DIAGRAM

User table

Authenticated of user name and password


Login Select your level

User table

New User registrati on table

Fig1 User Login

User Login

Select your level

Quantit ative aptitud e

English

Technic al

Question DB

Start Test

View Result

fig 2. Exam level

LITERATURE SURVEY 5.1 JAVA- FRONT END


The JAVA language was created by James Gosling in June 1991 for use in a set top box project.[4] The language was initially called Oak, after an oak tree that stood outside Gosling's office - and also went by the name Green - and ended up later being renamed to Java, from a list of random words.[5] Gosling's goals were to implement a virtual machine and a language that had a familiar C/C++ style of notation.[6] The first public implementation was Java 1.0 in 1995. It promised "Write Once, Run Anywhere" (WORA), providing no-cost runtimes on popular platforms. It was fairly secure and its security was configurable, allowing network and file access to be restricted. Major web browsers soon incorporated the ability to run secure Java applets within web pages. Java quickly became popular. With the advent of Java 2, new versions had multiple configurations built for different types of platforms. For example, J2EE was for enterprise applications and the greatly stripped down version J2ME was for mobile applications. J2SE was the designation for the Standard Edition. In 2006, for marketing purposes, new J2 versions were renamed Java EE, Java ME, and Java SE, respectively. In 1997, Sun Microsystems approached the ISO/IEC JTC1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process.[7][8][9] Java remains a de facto standard that is controlled through the Java Community Process.[10] At one time, Sun made most of its Java implementations available without charge although they were proprietary software. Sun's revenue from Java was generated by the selling of licenses for specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) which is a subset of the SDK, the primary distinction being that in the JRE, the compiler, utility programs, and many necessary header files are not present. On 13 November 2006, Sun released much of Java as free software under the terms of the GNU General Public License (GPL). On 8 May 2007 Sun finished the process, making all of Java's core code open source, aside from a small portion of code to which Sun did not hold the copyright.[11]

The Java Programming Language The Java programming language is a high-level language that can be characterized by all of the following buzzwords: Simple Object neutral Architecture

Portable oriented Distributed High performance Multithreaded Robust Dynamic Secure Each of the preceding buzzwords is explained in The Java Language Environment , a white paper written by James Gosling and Henry McGilton. In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes the machine language of the Java Virtual Machine1 (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine.

An overview of the software development process. Because the Java VM is available on many different operating systems, the same .class files are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS), Linux, or Mac OS. Some virtual machines, such as the Java HotSpot virtual machine, perform additional steps at runtime to give your application a performance boost. This include various

tasks such as finding performance bottlenecks and recompiling (to native code) frequently used

sections of code. Through the Java VM, the same application is capable of running on multiple platforms. The Java Platform A platform is the hardware or software environment in which a program runs. We've already mentioned some of the most popular platforms like Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described as a combination of the operating system and underlying hardware. The Java platform differs from most other platforms in that it's a softwareonly platform that runs on top of other hardware-based platforms. The Java platform has two components:

The Java Virtual Machine The Java Application Programming Interface (API) Java Runtime Environment

Main article: Java Runtime Environment The Java Runtime Environment, or JRE, is the software required to run any application deployed on the Java Platform. End-users commonly use a JRE in software packages and Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, Jar and debugger. One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should not 'crash' the system. Moreover, in runtime engine environments such as Java there exist tools that attach to the runtime engine and every time that an exception of interest occurs they record debugging information that existed in memory at the time the exception was thrown (stack and heap values). These Automated Exception Handling tools provide 'root-cause' information for exceptions in Java programs that run in production, testing or development environments.

5.2 JSP FRONT END


JavaServer Pages (JSP) is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents in response to a Web client request. The technology allows Java code and certain pre-defined actions to be embedded into static content. The JSP syntax adds additional XML-like tags, called JSP actions, to be used to invoke built-in functionality. Additionally, the technology allows for the creation of JSP tag libraries that act as extensions to the standard HTML or XML tags. Tag libraries provide a platform independent way of extending the capabilities of a Web server. JSPs are compiled into Java Servlets by a JSP compiler. A JSP compiler may generate a servlet in Java code that is then compiled by the Java compiler, or it may generate byte code for the servlet directly. JSPs can also be interpreted on-the-fly reducing the time taken to reload changes JavaServer Pages (JSP) technology provides a simplified, fast way to create dynamic web content. JSP technology enables rapid development of web-based applications that are serverand platform-independent.

SERVLETS FRONT END

The Java Servlet API allows a software developer to add dynamic content to a Web server using the Java platform. The generated content is commonly HTML, but may be other data such as XML. Servlets are the Java counterpart to non-Java dynamic Web content technologies such as PHP, CGI and ASP.NET. Servlets can maintain state across many server transactions by using HTTP cookies, session variables or URL rewriting. The Servlet API, contained in the Java package hierarchy javax.servlet, defines the expected interactions of a Web container and a servlet. A Web container is essentially the component of a Web server that interacts with the servlets. The Web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights. A Servlet is an object that receives a request and generates a response based on that request. The basic servlet package defines Java objects to represent servlet requests and responses, as well as objects to reflect the servlet's configuration parameters and execution environment. The package javax.servlet.http defines HTTP-specific subclasses of the generic servlet elements, including session management objects that track multiple requests and responses between the Web server and a client. Servlets may be packaged in a WAR file as a Web application. Servlets can be generated automatically by JavaServer Pages (JSP), or alternately by template engines such as WebMacro. Often servlets are used in conjunction with JSPs in a pattern called "Model 2", which is a flavor of the model-view-controller pattern. Servlets are Java technology's answer to CGI programming. They are programs that run on a Web server and build Web pages. Building Web pages on the fly is useful (and commonly done) for a number of reasons:

The Web page is based on data submitted by the user. For example the results pages from search engines are generated this way, and programs that process orders for e-commerce sites do this as well.

The data changes frequently. For example, a weather-report or news headlines page might build the page dynamically, perhaps returning a previously built page if it is still up to date.

The Web page uses information from corporate databases or other such sources. For example, you would use this for making a Web page at an on-line store that lists current prices and number of items in stock.

The Servlet Run-time Environment A servlet is a Java class and therefore needs to be executed in a Java VM by a service we call a servlet engine.
The servlet engine loads the servlet class the first time the servlet is requested, or optionally already when the servlet engine is started. The servlet then stays loaded to handle multiple requests until it is explicitly unloaded or the servlet engine is shut down. Some Web servers, such as Sun's Java Web Server (JWS), W3C's Jigsaw and Gefion Software's LiteWebServer (LWS) are implemented in Java and have a built-in servlet engine. Other Web servers, such as Netscape's Enterprise Server, Microsoft's Internet Information Server (IIS) and the Apache Group's Apache, require a servlet engine add-on module. The add-on intercepts all requests for servlets, executes them and returns the response through the Web server to the client. Examples of servlet engine add-ons are Gefion Software's WAICoolRunner, IBM's WebSphere, Live Software's JRun and New Atlanta's ServletExec. All Servlet API classes and a simple servlet-enabled Web server are combined into the Java Servlet Development Kit (JSDK), available for download at Sun's official Servlet site .To get started with servlets I recommend that you download the JSDK and play around with the sample servlets.

Life Cycle OF Servlet


The Servlet lifecycle consists of the following steps: 1. The Servlet class is loaded by the container during start-up.
2. The container calls the init() method. This method initializes the servlet and must be

called before the servlet can service any requests. In the entire life of a servlet, the init() method is called only once.
3. After initialization, the servlet can service client-requests. Each request is serviced in

its own separate thread. The container calls the service() method of the servlet for every request. The service() method determines the kind of request being made and dispatches it to an appropriate method to handle the request. The developer of the

servlet must provide an implementation for these methods. If a request for a method that is not implemented by the servlet is made, the method of the parent class is called, typically resulting in an error being returned to the requester.
4. Finally, the container calls the destroy() method which takes the servlet out of

service. The destroy() method like init() is called only once in the lifecycle of a Servlet.

Request and Response Objects


HttpServletRequest and HttpServletResponse, these two objects give you full access to all information about the request and let you control the output sent to the client as the response to the request. With CGI you read environment variables and stdin to get information about the request, but the names of the environment variables may vary between implementations and some are not provided by all Web servers. The HttpServletRequest object provides the same information as the CGI environment variables, plus more, in a standardized way. It also provides methods for extracting HTTP parameters from the query string or the request body depending on the type of request (GET or POST). As a servlet developer you access parameters the same way for both types of requests. Other methods give you access to all request headers and help you parse date and cookie headers. Instead of writing the response to stdout as you do with CGI, you get an OutputStream or a PrintWriter from the HttpServletResponse. The OuputStream is intended for binary data, such as a GIF or JPEG image, and the PrintWriter for text output. You can also set all response headers and the status code, without having to rely on special Web server CGI configurations such as Non Parsed Headers (NPH). This makes your servlet easier to install.

ServletConfig and ServletContext


There is only one ServletContext in every application. This object can be used by all the servlets to obtain application level information or container details. Every servlet, on the other hand, gets its own ServletConfig object. This object provides initialization parameters for a servlet. A developer can obtain the reference to ServletContext using either the ServletConfig object or ServletRequest object.

All servlets belong to one servlet context. In implementations of the 1.0 and 2.0 versions of the Servlet API all servlets on one host belongs to the same context, but with the 2.1 version of the API the context becomes more powerful and can be seen as the humble beginnings of an Application concept. Future versions of the API will make this even more pronounced. Many servlet engines implementing the Servlet 2.1 API let you group a set of servlets into one context and support more than one context on the same host. The ServletContext in the 2.1 API is responsible for the state of its servlets and knows about resources and attributes available to the servlets in the context. Here we will only look at how ServletContext attributes can be used to share information among a group of servlets. There are three ServletContext methods dealing with context attributes: getAttribute, setAttribute and removeAttribute. In addition the servlet engine may provide ways to configure a servlet context with initial attribute values. This serves as a welcome addition to the servlet initialization arguments for configuration information used by a group of servlets, for instance the database identifier we talked about above, a style sheet URL for an application, the name of a mail server, etc.

5.3 MYSQL BACK END


The MySQL Reference Manual covers most areas of MySQL use. This manual is for both MySQL Community Server and MySQL Enterprise Server. If you cannot find the answer(s) from the manual, you can get support by purchasing MySQL Enterprise, which provides comprehensive support and services. MySQL Enterprise also provides a comprehensive knowledge base library that includes hundreds of technical articles resolving difficult problems on popular database topics such as performance, replication, and migration. MySQL AB develops and supports a family of high-performance, affordable database products. The company's flagship offering is 'MySQL Enterprise', a comprehensive set of production-tested software, proactive monitoring tools, and premium support services. MySQL is the world's most popular open source database software. Many of the world's largest and fastest-growing organizations use MySQL to save time and money powering their high-volume Web sites, business-critical systems and packaged software -- including industry leaders such as Yahoo!, Alcatel-Lucent, Google, Nokia, YouTube and Booking.com. With headquarters in the

United States and Sweden -- and operations around the world -- MySQL AB supports both open source values and corporate customers' needs. The following features are implemented by MySQL

Multiple storage engines, allowing you to choose the one which is most effective for each table in the application (in MySQL 5.0, storage engines must be compiled in; in MySQL 5.1, storage engines can be dynamically loaded at run time):

Native storage engines (MyISAM, Falcon, Merge, Memory (heap), Federated, Archive, CSV, Blackhole, Cluster, BDB, EXAMPLE), and Maria Partner-developed storage engines (InnoDB, solidDB, NitroEDB, BrightHouse) Community-developed storage engines (memcached, httpd, PBXT) Custom storage engines Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.

JDBC

Java Database Connectivity (JDBC) is a programming framework for Java developers writing programs that access information stored in databases, spreadsheets, and flat files. JDBC is commonly used to connect a user program to a "behind the scenes" database, regardless of what database management software is used to control the database. In this way, JDBC is cross-platform . This article will provide an introduction and sample code that demonstrates database access from Java programs that use the classes of the JDBC API, which is available for free download from Sun's site.

A database that another program links to is called a data source. Many data sources, including products produced by Microsoft and Oracle, already use a standard called Open Database Connectivity (ODBC). Many legacy C and Perl programs use ODBC to connect to data sources. ODBC consolidated much of the commonality between database management systems. JDBC builds on this feature, and increases the level of abstraction. JDBC-ODBC bridges have been created to allow Java programs to connect to ODBC-enabled database software.

JDBC Architecture
Two-tier and Three-tier Processing Models The JDBC API supports both two-tier and three-tier processing models for database access.

Fig 5.8 In the two-tier model, a Java applet or application talks directly to the data source. This requires a JDBC driver that can communicate with the particular data source being accessed. A user's commands are delivered to the database or other data source, and the results of those statements are sent back to the user. The data source may be located on another machine to which the user is connected via a network. This is referred to as a client/server configuration, with the user's machine as the client, and the machine housing the data source as the server. The network can be an intranet, which, for example, connects employees within a corporation, or it can be the Internet. In the three-tier model, commands are sent to a "middle tier" of services, which then sends the commands to the data source. The data source processes the commands and sends the results back to the middle tier, which then sends them to the user. MIS directors find the threetier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that it simplifies the deployment of applications. Finally, in many cases, the three-tier architecture can provide performance advantages.

Fig 5.9 Until recently, the middle tier has often been written in languages such as C or C++, which offer fast performance. However, with the introduction of optimizing compilers that translate Java byte code into efficient machine-specific code and technologies such as Enterprise JavaBeans, the Java platform is fast becoming the standard platform for middle-tier development. This is a big plus, making it possible to take advantage of Java's robustness, multithreading, and security features. With enterprises increasingly using the Java programming language for writing server code, the JDBC API is being used more and more in the middle tier of a three-tier architecture. Some of the features that make JDBC a server technology are its support for connection pooling, distributed transactions, and disconnected rowsets. The JDBC API is also what allows access to a data source from a Java middle tier. DriverManager This is a very important class. Its main purpose is to provide a means of managing the different types of JDBC database driver On running an application, it is the DriverManager's responsibility to load all the drivers found in the system property j dbc . drivers. For example, this is where the driver for the Oracle database may be defined. This is not to say that a new driver cannot be explicitly stated in a program at runtime which is not included in jdbc.drivers. When opening a connection to a database it is the DriverManager' s role to choose the most appropriate driver from the previously loaded drivers. Connection When a connection is opened, this represents a single instance of a particular database session. As long as the connection remains open, SQL queries may be executed and results

obtained. More detail on SQL can be found in later chapters and examples found in Appendix A. This interface can be used to retneve information regarding the table descriptions, and any other information about the database to which you are connected. By using Connection a commit is automatic after the execution of a successful SQL statement, unless auto commit has been explicitly disabled. In this case a commit command must follow each SQL statement, or changes will not be saved. An unnatural disconnection from the database during an SQL statement will automatically result in the rollback of that query, and everything else back to the last successful commit. Statement The objective of the Statement interface is to pass to the database the SQL string for execution and to retrieve any results from the database in the form of a ResultSet. Only one ResultSet can be open per statement at any one time. For example, two ResultSets cannot be compared to each other if both ResultSets stemmed from the same SQL statement. If an SQL statement is re-issued for any reason, the old Resultset is automatically closed. ResultSet A ResultSet is the retrieved data from a currently executed SQL statement. The data from the query is delivered in the form of a table. The rows of the table are returned to the program in sequence. Within any one row, the multiple columns may be accessed in any order A pointer known as a cursor holds the current retrieved record. When a ResUltSet is returned, the cursor is positioned before the first record and the next command (equivalent to the embedded SQL FETCH command) pulls back the first row. A ResultSet cannot go backwards. In order to re-read a previously retrieved row, the program must close the ResultSet and re-issue the SQL statement. Once the last row has been retrieved the statement is considered closed, and this causes the Resu1~Set to be automatically closed. CallableStatement This interface is used to execute previously stored SQL procedures in a way which allows standard statement issues over many relational DBMSs. Consider the SQL example: SELECT cname FROM tnaine WHERE cname = var; If this statement were to be stored, the program would need a way to pass the parameter var into the callable procedure. Parameters passed into the call are referred to sequentially, by number.

When defining a variable type in JDBC the program must ensure that the type corresponds with the database field type for IN and OUT parameters. DatabaseMetaData This interface supplies information about the database as a whole. MetaData refers to information held about data. The information returned is in the form of ResultSet5. Normal ResultSet methods, as explained previously, may be used in this instance. If metadata is not available for the particular request then an SQLException will occur. Driver For each database driver a class that implements the Driver interface must be provided. When such a class is loaded it should register itself with the DriverManager, which will then allow it to be accessed by a program. PreparedStatement A PreparedStatement object is an SQL statement which is pre-compiled and stored. This object can then be executed multiple times much more efficiently than preparing and issuing the same statement each time it is needed. When defining a variable type in JDBC, the program must ensure that the type corresponds with the database field type for IN and OUT parameters. ResultSetMetaData This interface allows a program to determine types and properties in any columns in a ResultSet. It may be used to find out a data type for a particular field before assigning its variable type. Types The Types class determines any constants that are used to identify SQL types. Numeric The object of the Numeric class is to provide high precision in numeric computations that require fixed point resolution. Examples include monetary or encryption key applications. These equate to database SQL NUMERIC or DECIMAL types. Driver Interface The driver side of the JDBC layer is the part that interfaces to the actual database, and therefore is generally written by database vendors. Most developers

only need to know how to install and use drivers. The JDBC Driver API defines a set of interfaces which have to be implemented by a vendor JDBC is based on Microsoft's Open Database Connectivity (ODBC) interface which many of the mainstream databases have adopted. Therefore, a JDBCODBC bridge is supplied as part of JDBC, which allows most databases to be accessed before the Java driver is released. Although efficient and fast, it is recommended that the actual database JDBC driver is used rather than going through another level of abstraction with ODBC. Developers have the power to develop and test applications that use the JDBC-ODBC bridge. If and when a proper driver becomes available they will be able to slot in the new driver and have the applications utilise it instantly, without the need for rewriting. However, do not assume the JDBC-ODBC bridge is a bad alternative. It is a small and very efficient way of accessing databases.

Connecting to a database
In order to connect to a database, you need to perform some initialization first. Your JDBC driver has to be loaded by the Java Virtual Machine classloader, and your application needs to check to see that the driver was successfully loaded. We'll be using the ODBC bridge driver, but if your database vendor supplies a JDBC driver, feel free to use it instead. To load the JdbcOdbcDriver class, and then catch the ClassNotFoundException if it is thrown. This is important, because the application might be run on a non-Sun virtual machine that doesn't include the ODBC bridge, such as Microsoft's JVM. If this occurs, the driver won't be installed, and our application should exit gracefully. Once our driver is loaded, we can connect to the database. We'll connect via the driver manager class, which selects the appropriate driver for the database we specify.

5.4 MODEL VIEW CONTROLLER (MVC)


Model-view-controller (MVC) is an architectural pattern, which at the same time is also a Multitier architecture, used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface. The model-view-

controller solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component: the controller. Pattern description It is common to split an application into separate layers: presentation (UI), domain logic, and data access. In MVC the presentation layer is further separated into view and controller. MVC encompasses more of the architecture of an application than is typical for a design pattern. Model The domain-specific representation of the information on which the application operates. Domain logic adds meaning to raw data (e.g., calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). Many applications use a persistent storage mechanism (such as a database) to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the Model. View Renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. Controller Processes and responds to events, typically user actions, and may invoke changes on the model. MVC is often seen in web applications, where the view is the actual HTML page, and the controller is the code that gathers dynamic data and generates the content within the HTML. Finally, the model is represented by the actual content, usually stored in a database or XML files. Though MVC comes in different flavors, control flow generally works as follows:
1. The user interacts with the user interface in some way (e.g., presses a button). 2. A controller handles the input event from the user interface, often via a registered handler

or callback.

3. The controller accesses the model, possibly updating it in a way appropriate to the user's

action (e.g., controller updates user's Shopping cart).[3]


4. A view uses the model (indirectly) to generate an appropriate user interface (e.g., the

view produces a screen listing the shopping cart contents). The view gets its own data from the model. The model has no direct knowledge of the view. The user interface waits for further user interactions, which begins the cycle anew.

6. Implementation
In order to use the service the user should register by providing a username and password. This information will be sent to the server. If the user is already registered, he/she can login to the service by entering his username and password. Information will be sent to the server in order to decide giving the user a permission to use the service or not. The user can add any other registered user to his/her list. Also the user must specify whether to consider the added user as a friend or as a family member. After adding a user to the list, the request goes to the outgoing requests list of the user and to the incoming requests list of the added friend or family member. The friend or family member can choose whether to accept the incoming request or reject it. Also the user can cancel the request at any time. After adding a user to the list, the request goes to the outgoing requests list of the user and to the incoming requests list of the added friend or family member.

The friend or family member can choose whether to accept the incoming request or reject it. Also the user can cancel the request at any time. A user can retrieve the location of a family member at any time with the distance between both of them and the last time the family member updated the server with his/her location. This is done by sending a request to the server. Every time the application updates the server with the location of users, it retrieves the friends that are within 1km away from the user.

6.1 SERVER FUNCTION MODULE


The Server gets the registration information and saves them into users table in the Database .The Server gets the login information, and makes sure that the user has an access to the system or not by checking the information with ones stored in the database. The Server gets information from the application, and then it adds the new member to the user list. The Server sends the incoming requests list and outgoing requests list to any user when ever he/she requests. Then it gets the user response on any user in the list and performs an action (accept, reject, cancel request).The Server gets the coordinates of a user location and stores them in the database. The Server provides the application with a family member location of a user list with the location update time and the distance between the user and the family member.The Server calculates the distance between two friends according to the coordinates stored in the database and alerts the friends if they are nearby.

6.2 DATABASE FUNCTION MODULE


The Users Table stores all the users with their login information and location. Then the Users Friends Family List Table stores the lists of all users that use the service. The Location Tables Table contains Locations name with their corresponding coordinates.

7. System Testing
Testing is a process of executing a program with the intent of an error. A good test has a high probability of finding an as yet undiscovered error. A successful test is one that uncovers an as yet undiscovered error finding

The objective is to design tests that systematically uncover different classes of errors and do so with a minimum amount of time and effort. Testing cannot show the absence of defects, it can only show that software defects are present.

UNIT TESTING
Interface Number of input parameters should be equal to number of arguments. Parameter and argument attributes must match. Parameters passed should be in correct order. Global variable definitions consistent across module. If module does I/O, File attributes should be correct. Open/Close statements must be correct. Format specifications should match I/O statements. Buffer Size should match record size. Files should be opened before use. End of file condition should be handled. I/O errors should be handled. Any textual errors in output information must be checked. Improper or inconsistent typing. Erroneous initialization or default values. Incorrect variable names. Inconsistent date types. Overflow, underflow, address exceptions.

Local Data Structures (common source of errors!)

Boundary conditions and Independent paths Error Handling Error description unintelligible. Error noted does not correspond to error encountered. Error condition handled by system run-time before error handler gets control.

Exception condition processing incorrect.

INTEGRATION TESTING
Top down Integration Modules integrated by moving down the program design hierarchy. Can use depth first or breadth first top down integrationVerifies major control and decision points early in design process. Top-level structure tested most. Depth first implementation allows a complete function to be implemented, tested and demonstrated. Can do depth first implementation of critical functions early. Top down integration forced (to some extent) by some development tools in programs with graphical user interfaces. Begin construction and testing with atomic modules (lowest level modules).Bottom up integration testing as its name implies begins construction and testing with atomic modules. Because modules are integrated from the bottom up, processing required for modules subordinate to a given level is always available and the need for stubs is eliminated

Valiadation Testing
Validation testing is aims to demonstrate that the software functions in a manner that can be reasonably expected by the customer. These test conformance the software requirement Specifications. Validation Test Criteria A set of black box test is to demonstrate conformance with requirements. To check that all functional requirements satisfied, all performance requirements achieved, documentation is correct and ' human-engineered', and other requirements are met (e.g. compatibility, error recovery, and maintainability). When validation tests fail it may be too late to correct the error prior to scheduled delivery. Need to negotiate a method of resolving deficiencies with the customer.

Configuration Review An audit to ensure that all elements of the software configuration are properly developed catalogued and has all the necessary detail to support maintenance.

Alpha And Beta Testing


It is difficult to anticipate how users will really use software. If there is one customer, a series of acceptance tests are conducted (by the customer) to enable the customer to validate all requirements. If software is being developed for use by multiple customers, cannot use acceptance testing. An alternative is to use alpha and beta testing to uncover errors. A customer conducts alpha testing at the developer's site. The customer uses the software with the developer 'looking over the shoulder' and recording errors and usage problems. Alpha testing conducted in a controlled environment Beta testing is conducted at one or more customer sites by end users. It is ' live ' testing in an environment not controlled by developer. The customer records and reports are difficulties and errors at regular intervals.

System Testing
Software is only one component of a system. Software will be incorporated with other system components and system integration and validation test performance.

Recovery Testing
Many systems need to be fault tolerant-processing faults must not cause overall system failure. Other systems require after a failure within a specified time. Recovery testing is the forced failure of the software in a variety of ways to verify that recovery is properly performed.

Security Testing
System with sensitive information or which have the potential to harm individuals can be target for improper or illegal use. This can include: attempted penetration of the system by outside individuals for fun or disgruntled or dishonest employees. personal gain. During security testing the tester plays the role of the individual trying to penetrate the system. Large range of methods: Attempt to acquire passwords through external clerical means. Use custom software to attack the system. Overwhelm the system with requests. Cause system errors and attempt to penetrate the system during

recovery.

Browse through insecure data.

Given time and resources, the security of most systems can be breached.

Performance Testing
For real-time and embedded systems, functional requirements may be satisfied but performance problems make the system unacceptable. Performance testing checks the run-time performance in the context of the integrated system Can be coupled with stress testing, May require special software instrumentation. Testing under various software development stages Requirements Stage The requirements documents are tested by disciplined inspection and review. The preparation of test plan, which should include: 1. Specification 2. Description of test precious 3. Test milestones 4. Test Schedule 5. Test data reduction 6. Evaluation criteria Design Stage Design products are tested by analysis, simulation, walkthrough and inspection. Test data for functions are generated. Test cases based on structure of system are generated. Construction Stage This stage includes the actual execution of code with test data. Code walkthrough and inspection are conducted. Static analysis, Dynamic analysis, Construction of test drivers, hair nesses and stubs are done. Control and management of test process is critical. All test sets, test results and test reports should be catalogued and stored. Operation and Maintenance Stage Modifications done to the software requires retesting this is termed regression testing. Changes at a given level will necessitate retesting at all levels below it. Approaches Two basics approach: 1. Black box or "Functional" analysis

2. White box or "Structural" analysis Boundary value analysis (Stress Testing) In this method the input data is partitioned and data inside and at the boundary of each partition is tested. Design based functional testing Functional hierarchy is constructed. For each function at each level it will generate extremal, non-extremal and special output values. Cause-effect graphing In this method the characteristic input stimuli (Causes), characteristic output classes (effects) are identified. The dependencies are identified using specification. These details are presented as directed graph. Test cases are chosen to test dependencies. Coverage-Based Testing The Program is represented as control-flow graph. The paths are identified. Data are chosen to maximize paths executed under test conditions. For paths that are not always finite and those infeasible, Coverage metrics can be applied. . Complexity-based testing The Cyclomatic Complexity is measured. The paths actually executed by program running on test data are identified and the actual complexity is set. A test set is devised which will drive actual complexity closer to Cyclomatic complexity. Test Data Analysis During Test Data Analysis The Goodness of the test data set" is taken into major consideration. extrenal, nonextreamal and special value test data are identified. Test data is identified such that

Statistical analysis and error seeding


Known errors are seeded into the code so that their placement is statistically similar to that of actual errors . Mutation Analysis It is assumed that a set of test data that can uncover all simple faults in a program is capable of detecting more complex faults. In mutation analysis a large number of simple faults, called mutation, are introduced in a program one at a time .The resulting changed versions of the test program are called mutates. Test data is then

be constructed to cause these mutants to fail. The effectiveness of the test data set is measured by the percentage to mutants killed. Test Results The listed tests were conducted in the software at the various developments stages. Unit testing was conducted. The errors were debugged and regression testing was performed. The integration testing will be performed once the system is integrated with other related systems like Inventory, Budget etc. Once the design stage was over the Black Box and White Box Testing was performed on the entire application. The results were analyzed and the appropriate alterations were made. The test results proved to be positive and henceforth the application is feasible and test approved.

CONCLUSION:
The Placement mocktest System is developed using Java and Sql fully meets the objectives of the system for which it has been developed. The system has reached a steady state where all bugs have been eliminated. The system is operated at a high level of efficiency and the user associated with the system understands its advantage. The system solves the problem. It was intended to solve as requirement specification.

A. Sample Coding B.Bibliography


[1] WebCT,Web Courses Tolls,http://www.webCT.com. [2] Tinoco, L., Fox, E. and Barnette, D. Online evaluation in WWW-based courseware, In Proceedings of the 28th SIGCSE Technical Symposium(1997), pp. 194-198. [3] Jackson, D., Usher, M. Grading student programs using ASSYS T, In Proceedings of the 28th SIGCSE Technical Symposium (1997), pp.335-339. [4] Stina, B., Michael T., Stephen G., Roberto T., PILOT: An Interactive Tool for Learning and Grading, SIGCSEB: SIGCSE Bulletin,2000. [5] Peter Brusilovsky and Philip Miller, Web-based Testing for Distance Education, Proceedings of WebNet'99, World Conference of the WWW and Internet, Honolulu, HI, Oct. 24-30, 1999, AACE, pp. 149-154 [6]RuiMin Shen, Yiyang Tang, Tongzhen Zhang, The intelligent assessment system in Web-Based Distance Learning Education, FIE 2001.

You might also like