Java代写:CSC2021LoggingTest


代写关于 [ Test-Driven Development ](https://en.wikipedia.org/wiki/Test-
driven_development “Test-Driven Development”)
开发模式的设计和实现。需要先设计UML图,然后编写对应的测试,最后实现代码逻辑部分。

Introduction

In this coursework you will use UML and then a mix of “standard” development
and Test-Driven Development (TDD) to design and implement a simple patient
record management system for a doctor’s surgery. This Java class shall be
referred to in this specification as the Appointment Manager. This coursework
is worth 15% of the module mark for CSC2021.
We have a framework which you can use to create your test classes and provide
a log of the tests you undertake.

Aim

  • To produce a UML class diagram
  • To use TDD to implement some parts of a Java program
  • Learning/Skill Outcomes:
    This coursework will enable you to practice the following skills:
  • UML class designs
  • TDD
  • Java programming

Specification

Task 1

Produce a UML class diagram for the system you intend to implement. This
specification is intentionally a little vague, so as not to lead directly to
tests in Task 3. You should think about what specifics are appropriate in
order to write useful tests. You should call the class which has these
features AppointmentManager.java. The Appointment Manager should have the
following features:

  1. It should be possible to create multiple Appointment Managers (e.g. for different surgeries).
  2. The data in the Appointment Manager only needs to exist during runtime.
    * There does not need to be any persistence beyond the lifetime of the program.
  3. The following information must be stored about each patient by the Appointment Manager: name, address (as a String), phone number and date of birth plus a list of past appointments. Each past appointment consists of a date and a free text description of that appointment. Note that data types representing dates can be either Strings or Dates.
  4. Each entry should have a unique and unchangeable patient ID.
  5. A full list of all patients and their details should be able to be retrieved from an Appointment Manager.
  6. You should be able to search the Appointment Manager (for completely matching) names.
    * This should return a list of all matches and their details.
  7. It should be possible to use the Appointment Manager to change a patient’s name and address.
  8. It should be possible to use the Appointment Manager to add the details of a new appointment for a patient, given their Patient ID.

Important note for Task 1

You may use whatever drawing/design tool you wish to produce your UML diagram.

Task 2

Implement the features up to and including Feature 5 WITHOUT using TDD. You
should implement the design you produced in Task 1 and MUST explain (in the
header comments of your production code) if you have made changes.
You should use the Eclipse framework as this is needed for Task 3 in which you
will be expanding on your production code. Setting up the framework now will
also set up the package structure for you. Follow the instructions at the end
of the assignment in order to obtain the framework and get it operational in
Eclipse.

Using the framework

The framework contains two Java classes, “AbstractLoggingJUnitTest.java” and
“ExampleLoggingTest.java”. “AbstractLoggingJUnitTest.java” is a base class for
your tests and must not be modified. “ExampleLoggingTest.java” is an example
of a test class, as you may have gathered. You are advised to leave this
unchanged but to use it as a template for your own test class/classes. You are
strongly advised to make sure your test class/classes are in the same package.
If you decide to use JUnit for Task 2, you should make sure your class
signatures include “extends AbstractLoggingJUnitTest”.

Important notes for Task 2

You MUST NOT follow TDD in Task 2! These features should be written however
you would normally write your code, e.g. using a test class and/or a driver
program.
You MUST still test your code! The markers will look for evidence of this,
e.g. a driver program and/or a test class for these features. It is up to you
whether you choose to use JUnit or not in Task 2.
You are advised to use some version control system to keep copies of the last
working version of your code. That way, if you make a mistake, it is easy to
check out the last working version again. This is not compulsory but is
recommended and also applies to Task 3.

Task 3

Implement features 6, 7, and 8 using TDD and JUnit. In the framework, you
should ensure that the JUnit test classes that you write are in the same
package as “AbstractLoggingJUnitTest.java” and that the class definition
includes “extends AbstractLoggingJUnitTest”. Again, implement the design from
Task 1 and explain (again in production code header comments) if you have made
changes.

Important notes for Task 3

You MUST follow TDD in Task 3! The markers will use the test log HTML files
provided by the framework to determine this. You should be alternating between
RED phase and GREEN phase . These transitions are visible in the log
file (failed tests generate WARN log events, which are coloured red).
You MUST USE A DIFFERENT TEST CLASS TO THAT USED FOR TASK 2.
Do NOT modify or delete the log files as this is the evidence you are
following TDD.
We appreciate that mistakes happen in the development process. So, you will
not be marked down for mistakes in the development process. It is the finished
product which is marked, the number of failed tests or amount of time taken to
get to the finished product will not be considered by the markers. It is the
quality of your tests and production code plus of course following TDD which
is important here.
The log files log the time that tests are run, we don’t mind when you work as
long as it is before the deadline!

Marking Scheme

This coursework is marked out of 30 with a breakdown as follows:

Task 1

  • 8 marks for your UML class diagram.

Task 2

  • 6 marks for evidence of testing the code produced in Task 2.

Task 3

  • 4 marks for use of the red-green cycle,
  • 4 marks for writing/running appropriate tests,
  • 2 marks for quality of test names,
  • 4 marks for structure and presentation of test methods,
  • 2 marks for implementing the production code based on your design from Task 1 (this also covers code developed in Task 2).

Submission and Deadlines

Your coursework must be submitted to the NESS system by the deadline
specified. Note that NESS imposes deadlines rigorously, and even work that is
a few seconds late (e.g. because of network delays caused by students all
submitting at the last moment) will be flagged as late.
Coursework 2 (TDD part II) has the same deadline but should be submitted
separately.
You must submit two files, a word document or pdf containing your UML diagram
and a zip archive (.zip file) containing all of your production code, all of
your test classes and all of the test logs. The easiest way to do this is to
zip up the project directory, i.e. the “ncl_csc2021_tddCoursework-master”
folder. The framework project directory that you initially download has all
the components required for a valid submission (though no code that will
achieve marks). NESS will require both files in order for you to submit. It is
YOUR responsibility to submit the correct files and to make sure the zip file
contains the correct classes and log files.
This module is taking part in a trial of standardised submission times, hence
all Semester 1 submissions are due at 8pm/20:00. In the unlikely event of a
NESS system failure, we will retrospectively move the deadline to the next
working day. Please note that for Friday submissions, the next working day is
Monday, not Saturday. Also remember that you are responsible for submitting
the correct files, submitting incorrect files is not a system failure or a
reason for a deadline extension.

Obtaining/testing the framework

Download and save the framework as a zip file from Blackboard, where it is in
the “Assessment” section. Extract the zip file. This should give a folder
called “ncl_csc2021_tddCoursework-master”.
Import this project into Eclipse as follows

  1. Go to File->Import-> Existing Projects into Workspace.
  2. Click “Next”.
  3. Select root directory to location of downloaded project.
  4. Click “Finish”.
    Now test that it is working. You should do this sooner rather than later and
    ideally in a practical class so you can talk to the demonstrators if something
    goes wrong.

To test

  1. Open “ExampleLoggingTest.java”
  2. Go to Run->Run As->JUnit Test (or use keyboard shortcut: F11)
  3. Console output should be:
    INFO : TestSuite [com.example.tddCoursework.ExampleLoggingTest] started
    WARN : Test [test] failed with exception [Not yet implemented]
    INFO : Test [test2] succeeded
    INFO : TestSuite [com.example.tddCoursework.ExampleLoggingTest] finished
    —|—
  4. Additionally, there should be an html log file at “ncl_csc2021_tddCoursework-master/log”. Open the log file in your browser to check it has log data in it - it should be showing a log session that started very recently.
  5. If you have reached this stage then it has worked.

Acknowledgements

Thanks to Dan Nesbitt for his help developing this coursework spec and to Dr
John Shearer for providing the framework used for Tasks 2 and 3.


文章作者: SafePoker
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 SafePoker !
  目录