Difference between revisions of "DIT085 Ed 2015 Practical Phase 2"
Line 47: | Line 47: | ||
</ErrorMsg> | </ErrorMsg> | ||
− | where reason | + | where reason is a string specifying the reason for failure; the string is to be displayed on the client side. |
+ | |||
+ | |||
+ | |||
+ | === Deleting a message === | ||
+ | |||
+ | <DelMessage> | ||
+ | <MsgId "ID" /> | ||
+ | </DelMessage> | ||
+ | |||
+ | Where MsgID is the unique identifier of the to-be-deleted message. | ||
+ | |||
+ | The serve will reply to the client with | ||
+ | |||
+ | <Message deleted: "MsgID" /> | ||
+ | |||
+ | |||
+ | if the message does not exist (e.g., it has already been fetched), or for any other reason the message is not deleted the following XML message is replied to the client: | ||
+ | |||
+ | <ErrorMsg> | ||
+ | Reason | ||
+ | </ErrorMsg> | ||
+ | |||
+ | See above for the description of Reason. | ||
+ | |||
+ | |||
+ | === Replacing a message === | ||
+ | |||
+ | <RplMessage> | ||
+ | <MsgId "ID" /> | ||
+ | <Content "TEXT" /> | ||
+ | </RplMessage> | ||
+ | |||
+ | Where ID is the unique identifier of the to-be-replaced message and TEXT is the new text to be put in the message. | ||
+ | |||
+ | The serve will reply to the client with | ||
+ | |||
+ | <Message replaced: "MsgID" /> | ||
+ | |||
+ | Depending on the implementation the MsgID may be the same as the old one, or a new unique identifier may be generated for the message. | ||
+ | If the message does not exist (e.g., it has already been fetched), the new text is empty, or for any other reason the message is not deleted the following XML message is replied to the client: | ||
+ | |||
+ | <ErrorMsg> | ||
+ | Reason | ||
+ | </ErrorMsg> | ||
+ | |||
+ | See above for the description of Reason. | ||
+ | |||
Line 64: | Line 111: | ||
== Part 2: TDD of New Modules == | == Part 2: TDD of New Modules == | ||
+ | You need to design a new module that can accept TCP/IP connections and spawn new threads to deal with the connections concurrently. | ||
+ | This module is to be designed in a TDD manner and its specification (interface, description, pre- and post-conditions, and test cases) are to be included in the report. | ||
+ | You do not need to include extra information about the techniques used to design the test-cases. | ||
== Part 3: Integration Testing == | == Part 3: Integration Testing == | ||
− | + | First document 5 sceanrios that capture the main functionalities of the server: these scenarios start from establishing a new connection from the client to the server, to one or more interactions that its has with the server, to closing the connection by the client. | |
+ | |||
+ | Implement these scenarios as a mock-up for the client (either on the server-side or as a separate application) using [https://code.google.com/p/mockito/ Mockito] (or similar tools). | ||
+ | |||
+ | Measure statement and interface coverage of your server-side application using [http://www.eclemma.org/ EclEmma] (or similar tools). | ||
+ | Design 5 additional scenarios such that each of them will increase at least one of your coverage criteria. | ||
+ | Document the scenario's and the reason you think they contribute to more coverage. | ||
+ | Implement them in your mock-up and document the resulting additional coverage for each and every scenario. | ||
=[[DIT085|Back to DIT085]]= | =[[DIT085|Back to DIT085]]= |
Revision as of 14:29, 5 February 2015
Contents
Objectives
The objective of phase 2 is to apply the following techniques and tools in a practical case study:
- Software integration,
- Integration testing, and
- Measuring code coverage and testability.
In addition, for the modules that are to be developed for this phase, we will keep on practicing test-driven development
General Description
This phase of the project concerns developing, integrating and integration testing of the modules that will together comprise a functioning WhatsUpGU server. The server should listen on port 4444 and should be able to accept multiple connections using the multi-threading mechanisms in Java (see, for example, Oracle's Tutorial on Concurrency in Java). Each connection is handled in a separate thread, all of which will access the messages concurrently. We assume that each user with a given ID should have at most one connection open at a time; multiple connections for the same user should be refused hence.
The server should provide an XML-based interface on its socket with the following specifications.
Accepting Connections
<Request connection id +/>
<Accepted connection from id +/>
where id is the unique identifier (account name) provided by the client.
Adding a message
<AddMessage> <Receiver "ID" /> <Content "TEXT" /> </AddMessage>
The serve will reply to the client with
<Message added: "MsgID" />
Where MsgID is the unique identifier of the added message.
if the text is empty or ID is not a valid receiver identifier, or for any other reason the message is not added the following XML message is replied to the client:
<ErrorMsg> Reason </ErrorMsg>
where reason is a string specifying the reason for failure; the string is to be displayed on the client side.
Deleting a message
<DelMessage> <MsgId "ID" /> </DelMessage>
Where MsgID is the unique identifier of the to-be-deleted message.
The serve will reply to the client with
<Message deleted: "MsgID" />
if the message does not exist (e.g., it has already been fetched), or for any other reason the message is not deleted the following XML message is replied to the client:
<ErrorMsg> Reason </ErrorMsg>
See above for the description of Reason.
Replacing a message
<RplMessage> <MsgId "ID" /> <Content "TEXT" /> </RplMessage>
Where ID is the unique identifier of the to-be-replaced message and TEXT is the new text to be put in the message.
The serve will reply to the client with
<Message replaced: "MsgID" />
Depending on the implementation the MsgID may be the same as the old one, or a new unique identifier may be generated for the message. If the message does not exist (e.g., it has already been fetched), the new text is empty, or for any other reason the message is not deleted the following XML message is replied to the client:
<ErrorMsg> Reason </ErrorMsg>
See above for the description of Reason.
Deliverables
There are two main deliverables for this phase: a single pdf file documenting the outcome of each and every of the following steps and a .zip file containing the source code of the software implemented in different parts.
Part 1: Architectural Design
First, make an architectural design of the server and decompose ints functionality into some distinct modules. The module you designed in phase 1 will certainly be part of this architectural design. It is recommended that you document your design using a given notation such as UML class diagrams (see, for example, IBM Rational's Tutorial on UML Structural Diagrams).
Part 2: TDD of New Modules
You need to design a new module that can accept TCP/IP connections and spawn new threads to deal with the connections concurrently. This module is to be designed in a TDD manner and its specification (interface, description, pre- and post-conditions, and test cases) are to be included in the report. You do not need to include extra information about the techniques used to design the test-cases.
Part 3: Integration Testing
First document 5 sceanrios that capture the main functionalities of the server: these scenarios start from establishing a new connection from the client to the server, to one or more interactions that its has with the server, to closing the connection by the client.
Implement these scenarios as a mock-up for the client (either on the server-side or as a separate application) using Mockito (or similar tools).
Measure statement and interface coverage of your server-side application using EclEmma (or similar tools).
Design 5 additional scenarios such that each of them will increase at least one of your coverage criteria. Document the scenario's and the reason you think they contribute to more coverage. Implement them in your mock-up and document the resulting additional coverage for each and every scenario.