代写辅导接单-CS2001 / CS2101 Week 4 FSM-JUnit and Test Driven Development

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top

CS2001 / CS2101 Week 4 FSM-JUnit and Test Driven Development

Objective

To gain experience with Test Driven Development and implementing and testing Abstract Data Types and Finite State Machines.

Learning Outcomes

By the end of this practical you should understand:

• how to design and implement unit tests

• how to use a Test Driven Development methodology to produce a robust implementation of a specified ADT interface.

Getting started

To start with, you should create a suitable assignment directory such as Documents/CS2001/W04-FSM-JUnit on the Linux lab clients. You should decompress the zip file at

http://studres.cs.st-andrews.ac.uk/CS2001/Coursework/W04-FSM-JUnit/code.zip

to your assignment directory. Please note that the zip file contains a number of files in the src di- rectory, some of which are blank or only partially implemented. Once you have extracted the zip file, you should probably delete it to avoid accidentally overwriting your src directory (and thereby your own implementation) with files contained in the zip.

Requirements

You are to develop an implementation of the ADT interfaces for a finite state machine and its transition table containing transitions in the interfaces package in the src directory following a TDD process. That is, your job is to write suitable tests in the test package (such as in the supplied Test classes) and implement all the classes in the impl package to satisfy these tests. Parts of impl.Factory have been implemented,forthisclassyouonlyneedtoimplementthemethodscontaining// TODOcomments.

Please note that you must NOT change the interfaces. Coding to a given interface is an important aspect of development and is seen as a valuable exercise for this assignment and many others.

Following the TDD process, try to write JUnit5 tests for each element of functionality before writing and testing its implementation. When writing your tests, consider the following:

 1

 

• Normal cases, with expected inputs.

• Edge cases, such as empty collections or collections containing a single element

• Cases where the implementation should (and should not) throw exceptions, dealing with nulls.

Should you find some aspects of the interfaces ambiguous, you will need to make a decision as to how to implement the interface, which your tests should make clear. Check the formal definitions of Finite State Machines for a source of clarifications.

Please note that you do not need to have a class with a main method which instantiates and uses your other classes. For this assignment, it is merely your JUnit tests that will instantiate, interact with and test your implementation of the ADTs.

Running the Automated Checker

You can run the automated checking system on your program by opening a terminal window connected to the Linux lab clients/servers and executing the following commands:

cd ~/Documents/CS2001/W04-FSM-JUnit

stacscheck /cs/studres/CS2001/Coursework/W04-FSM-JUnit/Tests

assuming Documents/CS2001/W04-FSM-JUnit is your assignment directory. This will run your own JUnit tests in the test package on your own ADT implementation. Some basic tests are in- cluded in the Tests classes in the test package. Some of these merely check that the factory method for creating a finite state machine, transition or transition table (which you will have to implement) calls a suitable constructor (which you will also have to implement) in your FiniteStateMachine, Transition, and TransitionTable classes. These tests also demonstrate how to use the factory to instantiate objects. Your first step could be to make these failing tests succeed before going on to add the next failing test(s), adding the corresponding implementation, re-running all tests etc. in the TDD process. The final test TestQ CheckStyle runs a program called Checkstyle over your source code using the Kirby Style which is described at

https://info.cs.st-andrews.ac.uk/student-handbook/learning-teaching/programming-style.html

Deliverables

Hand in via MMS, by the deadline of 9pm on Wednesday of Week 4, a zip file containing:

• Your assignment directory with all your source code, including your tests and ADT implementa- tions.

• A PDF report describing your test cases, how you chose those test cases, and how your choice of test cases influenced the implementation of your ADT. You should also explain and justify your ADT design and implementation decisions in clarity and detail.

Marking Guidance

The submission will be marked according to the mark descriptors used for CS2001/CS2101, which can be found at:

https://studres.cs.st-andrews.ac.uk/CS2001/0-General/descriptors.pdf

A very good attempt in an object-oriented fashion achieving almost all required functionality, together with a clear report showing a good level of understanding, can achieve a mark of 14 - 16. This means you should produce very good, re-usable code with very good method decomposition and provide a very good set of tests with clear explanations and justifications of design and implementation decisions in your report. To achieve a mark of 17 or above, you will need to implement all required functionality with a comprehensive set of test cases, testing all aspects of your design and covering any cases. Quality and clarity of design, implementation, testing, and your report are key at the top end.

 2

 

Lateness

The standard penalty for late submission applies (Scheme A: 1 mark per 24 hour period, or part thereof): http://info.cs.st-andrews.ac.uk/student-handbook/learning-teaching/assessment.html#lateness-penalties

Good Academic Practice

As usual, I would remind you to ensure you are following the relevant guidelines on good academic practice as outlined at

https://www.st-andrews.ac.uk/students/rules/academicpractice/

 3

 

 

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468