## Deliverable 2
For this assignment, your group will write code and unit tests for anauthorized reproduction of Coffee Maker Quest.
Requirements for this program are in the requirements.txt file in thisdirectory. In case of ambiguity, please see the original programcoffeemaker.jar as an example of what to display and how the system shouldwork.
Some of the work has already been done for you. Classes such asCoffeeMakerQuest.java, Config.java, Game.java, Player.java, Room.java, andTestRunner.java are already complete. You need only modifyCoffeeMakerQuestImpl.java and CoffeeMakerQuestTest.java. As in theexercise, the places where you need to modify code are marked by the // TODOcomments. DO NOT TOUCH the already complete classes as they will be used ASIS during grading. Here is a brief rundown of the classes:
* CoffeeMakerQuest.java the interface for the CoffeeMakerQuest game engine* Config.java allows configuration of bug injection into various classes* Game.java contains the main method; generates rooms and runs the game using the CoffeeMakerQuest engine* Player.java player object with inventory information* Room.java room object with furnishings and items* TestRunner.java the runner for the JUnit test class CoffeeMakerQuestTest* CoffeeMakerQuestImpl.java an implementation of CoffeeMakerQuest (_modify_)* CoffeeMakerQuestTest.java JUnit test class CoffeeMakerQuest (_modify_)
1. To run the game you need to invoke the Game class. For Windows:`runGame.bat`For Mac or Linux, try doing:`bash runGame.sh`When you run it without any modification, you will suffer an exception and crash. That is of course because you have not completed implementing CoffeeMakerQuestImpl.java!
1. To run the JUnit tests on CoffeeMakerQuestImpl, for Windows:`runTest.bat`For Mac or Linux, try doing:`bash runTest.sh`When you run it without any modification, you will get ALL TESTS PASSED. But dont get delirious. That is because all your tests are currently empty.
1. To run the JUnit tests on CoffeeMakerQuestBuggy (included in the form ofthe coffeemaker-buggy.jar file), for Windows:`runTestBuggy.bat`For Mac or Linux, try doing:`bash runTestBuggy.sh`
## Development Methodology
Like Exercise 2, we will try to apply the Test Driven Development (TDD) modelhere. Try writing the test case(s) FIRST before writing the code for afeature. This way, you will always have 100% test coverage for the code youhave written and are writing. Hence, if you break any part of it in the courseof adding a feature or refactoring your code, you will know immediately.
## Expected Outcome
You should see the following output when running runTest.bat (or runTest.sh):`ALL TESTS PASSED`
And after running runTestBuggy.bat (or runTestBuggy.sh), you should get output that looks like [runTestBuggy.output.txt](runTestBuggy.output.txt). If you do, this tells you that you have written your JUnit tests well so that they are able to find the bugs in CoffeeMakerQuestBuggy. Note that Ive commented out the following line at TestRunner.java:30 to make the output less verbose:`System.out.println(f.getTrace());`The above will print a full Java stack trace for every failure. It is useful when a test fails due to a crash in your program and you want to locate exactly in which source code line the Java exception was thrown. The defects in this CoffeeMakerQuestBuggy does not involve crashes due to exceptions so Ive temporarily commented it out for brevity.
## Additional Requirements
* Code coverage of the class CoffeeMakerQuestImpl when the JUnit TestRunner isrun should be at an absolute minimum of 80%. If coverage falls below thatnumber, add more unit tests in CoffeeMakerQuestTest.
* Write at least one private method while implementing CoffeeMakerQuestImpl.Add at least one unit test that tests that private method at the very bottomof CoffeeMakerQuestTest.
* Coding style is also important for software quality in the long run (eventhough they are not technically defects as we learned). In particular, auniform naming convention greatly improves the readability of your code. Awidely used convention is called[lowerCamelCase](https://en.wikipedia.org/wiki/Naming_convention_(programming)#Java)convention. That is the convention that was [first adopted when SunMicrosystems first created the Javalanguage](https://www.oracle.com/technetwork/java/codeconventions-135099.html).This is still the convention at the biggest companies using Java like[Oracle](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html)and [Google](https://google.github.io/styleguide/javaguide.html#s5-naming).Please make sure you follow the lower camel case convention for all yourvariables and methods for this project. There is less agreement on otherformatting issues like indentation and line wrapping, but try to maintain auniform convention whatever you choose.
## Grading
* GradeScope autograder: 70% of grade* Private method added and tested: 5% of grade* Source code style (lower camel case naming / formatting): 10% of grade* Code coverage: 15% of grade
Please review the grading_rubric.txt for details.
## Submission
Each pairwise group will submit the exercise *once* to GradeScope, by *one member* of the group. The submitting member will press the View or edit group link at the top-right corner of the assignment page after submission to add his/her partner. That way, both of you will get a grade. I recommend that you divide the list of methods to implement / test into two halves and working on one half each.
You will do two submissions for this deliverable.
1. You will create a github repository just for deliverable 2. Add your partner as a collaborator so both of you have access. Make sure you keep the repository *PRIVATE* so that nobody else can access your repository. This applies to all future submissions for this course. Once you are done modifying code, dont forget to commit and push your changes to the github repository. When you are done, submit your github repository to GradeScope at the Deliverable 2 GitHub link. Once you submit, GradeScope will run the autograder to grade you and give feedback. If you get deductions, fix your code based on the feedback and resubmit. Repeat until you dont get deductions.
1. Create a screenshot of code coverage stats given by your IDE of choice and name it code_coverage.png. Example:
https://github.com/wonsunahn/CS1632_Spring2020/blob/master/deliverables/2/code_coverage.png
I used Eclipse to generate the screenshot. Here is the user guide: https://www.eclemma.org/userdoc/launching.html. It is just a click of a button and requires no extra installation. You dont have to have 100% coverage for this exercise but you will have coverage requirements for your deliverable. I have already created an Eclipse project for you in the exercise directory so you can just open that to run TestRunner using File > Open Projects from File System from the menu. If you cant open the project for some reason, you need to create a new project using File > New > Java Project. For those of you who are new to eclipse, you need to include the four JAR files under CommandLineJUnit/ as external JARs for it to compile. You need to go to project properties > Java Build Path > Libraries and Add JARs or Add External JARs. Also, dont create module-info.java when prompted.
When you run the code coverage tool, make sure you run TestRunner, not Game. You can do that by clicking on and highlighting TestRunner.java before clicking on the code coverage button. Alternatively, you can right click on TestRunner.java and click on the Coverage as item in the menu that pops up. This is important. If you run Game.java, you will be getting the code coverage while playing the game.
After you have created the screenshot, save the picture to a PDF file and submit to GradeScope at the Deliverable 2 Coverage link. Make sure the picture fits in one page for easy viewing and grading.
## GradeScope Feedback
It is encouraged that you submit to GradeScope early and often. Please use the feedback you get on each submission to improve your code!
The GradeScope autograder works in 3 phases:
1. CoffeeMakerQuestImpl verification using CoffeeMakerQuestTestSolution:CoffeeMakerQuestTestSolution is the solution implementation ofCoffeeMakerQuestTest. The purpose of this phase is to verify that CoffeeMakerQuestImpl (your CoffeeMakerQuest implementation) does not have any defects.
1. CoffeeMakerQuestTest on CoffeeMakerQuestSolution: CoffeeMakerQuestTest is your submitted JUnit test for CoffeeMakerQuest. The purpose of this phase isto test CoffeeMakerQuestTest itself for defects. CoffeeMakerQuestSolution is the solution implementation of CoffeeMakerQuest and contains no defects (that I know of). Hence, all tests in CoffeeMakerQuestTest should pass.
1. CoffeeMakerQuestTest on CoffeeMakerQuestBuggy: CoffeeMakerQuestTest is your submitted JUnit test for CoffeeMakerQuest. The purpose of this phase isto test CoffeeMakerQuestTest against the buggy CoffeeMakerQuestBuggyimplementation. The class CoffeeMakerQuestBuggy is given to you in the form ofthe coffeemaker-buggy.jar file. Since CoffeeMakerQuestBuggy is buggy, youexpect the tests to fail this time. If CoffeeMakerQuestTestSolution fails atest but CoffeeMakerQuestTest passes a test (or vice versa), then this indicates a problem.
## Resources
These links are the same ones posted at the end of the slides:
* JUnit User manual:https://junit.org/junit5/docs/current/user-guide/The Writing Tests section is probably the most useful.
* JUnit Reference Javadoc:http://junit.sourceforge.net/javadoc/For looking up methods only, not a user guide.
* Mockito User Manual:https://javadoc.io/static/org.mockito/mockito-core/3.2.4/org/mockito/Mockito.htmlMost useful is the sections about verification and stubbing.
* Eclipse IDEIf you want more information, here is a page put up by a U Chicago professor:http://people.cs.uchicago.edu/~kaharris/10200/tutorials/eclipse/index.htmlIt uses a much earlier version of Eclipse, but other than the outdated UI, the operations are the same. I looked at several resources and this one was the most concise and to the point. A more comprehensive manual is at eclipse.org:https://help.eclipse.org/2019-12/index.jspLook at the Java development user guide chapter on the left.

![[Solved] CS1632 Deliverable2-Software Quality Assurance](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] CS1632 Supplement2](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.