{"id":95,"date":"2025-11-20T15:14:55","date_gmt":"2025-11-20T22:14:55","guid":{"rendered":"https:\/\/courses.cs.colostate.edu\/cs415\/?page_id=95"},"modified":"2026-03-03T10:12:47","modified_gmt":"2026-03-03T17:12:47","slug":"sprint-2","status":"publish","type":"page","link":"https:\/\/courses.cs.colostate.edu\/cs415\/sprint-2\/","title":{"rendered":"Sprint 2"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">P2. Sprint 2<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">ASSIGNED:&nbsp;5 March 2026<br>DUE:&nbsp;11:59PM, Thursday, 9 April 2026<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">100 points<\/h4>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">1. Objectives<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Assess mutation score of P1 test suite using PIT and improve it.<\/li>\n\n\n\n<li>Use static analysis tools (PMD and SpotBugs) and refactor the code to address issues.<\/li>\n\n\n\n<li>Use automatic test input generation tools (EvoSuite and Randoop).<\/li>\n\n\n\n<li>Implement the&nbsp;RestController&nbsp;class.<\/li>\n\n\n\n<li>Test&nbsp;RestController&nbsp;using Mockito to allow&nbsp;DBConnector&nbsp;to return different values.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">2. Mutation Analysis Tool PIT<\/h2>\n\n\n\n<p>Update your pom.xml to make PIT target only classes and tests inside the &#8216;model&#8217; package. Make sure the configuration of PIT inside your pom.xml looks like this:<\/p>\n\n\n\n<p>&lt;plugin&gt;<br>\u2003&lt;groupId&gt;org.pitest&lt;\/groupId&gt;<br>\u2003&lt;artifactId&gt;pitest-maven&lt;\/artifactId&gt;<br>\u2003&lt;version&gt;1.10.4&lt;\/version&gt;<br>\u2003&lt;configuration&gt;<br>\u2003\u2003&lt;targetClasses&gt;<br>\u2003\u2003\u2003&lt;param&gt;edu.colostate.cs415.model.*&lt;\/param&gt;<br>\u2003\u2003&lt;\/targetClasses&gt;<br>\u2003\u2003&lt;targetTests&gt;<br>\u2003\u2003\u2003&lt;param&gt;edu.colostate.cs415.model.*&lt;\/param&gt;<br>\u2003\u2003&lt;\/targetTests&gt;<br>\u2003&lt;\/configuration&gt;<br>&lt;\/plugin&gt;<\/p>\n\n\n\n<p>The workflow CI will produce mutation score information, so the graders willget the report from there. However, you should also collect this information and&nbsp;<strong>reflect<\/strong>&nbsp;on it in your mutation score report. Moreover, you will use this information to improve the test suite to get a higher mutation score.<\/p>\n\n\n\n<p>Run&nbsp;mvn test-compile org.pitest:pitest-maven:mutationCoverage. The mutation reports can be found inside&nbsp;target\/pit-reports.<\/p>\n\n\n\n<p><strong>Create a file&nbsp;reports\/P2_mutation.md&nbsp;in your repository.<\/strong>&nbsp;It should contain a coverage report showing in a tabular format, the mutation scores for the classes&nbsp;Company,&nbsp;Project,&nbsp;Worker, and&nbsp;Qualification. Remember to reflect on this table and lists tests you added to improve mutation scores.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">3. Static Analysis Tool<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">3.1. PMD<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install PMD.&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt; &lt;artifactId&gt;maven-pmd-plugin&lt;\/artifactId&gt; &lt;version&gt;3.13.0&lt;\/version&gt; &lt;\/plugin&gt;<\/li>\n\n\n\n<li>Run&nbsp;mvn pmd:pmd pmd:cpd<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">3.2. SpotBugs<\/h3>\n\n\n\n<p>Install SpotBugs from&nbsp;<a href=\"https:\/\/spotbugs.readthedocs.io\/en\/stable\/maven.html\">here<\/a>.<\/p>\n\n\n\n<p>Run PMD and SpotBugs and identify issues that you can address. Generate a screenshot for each tool that shows the issues before the code is refactored. Refactor your code to address the issues you selected. Generate another screenshot for each tool that shows the remaining issues and confirms that you addressed the issues you selected.<\/p>\n\n\n\n<p>As you refactor, please don&#8217;t make changes that can result in your code not compiling with ours. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Don&#8217;t include print statements anywhere in your submitted code.<\/li>\n\n\n\n<li>Don&#8217;t change the names\/spellings\/capitalization of methods, classes, enum types and values, and packages, and the types of parameters and associations.<\/li>\n\n\n\n<li>Don&#8217;t add any public or protected methods that are not listed. Feel free to add private methods if you need helper methods. The reason for disallowing public and protected methods is that using them will prevent your code from compiling with our code.<\/li>\n\n\n\n<li>Don&#8217;t add new classes\/interfaces\/enums.<\/li>\n<\/ul>\n\n\n\n<p><strong>The log files\/screenshots for static analysis must be put in a document called reports\/P2_sa.md.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">4. Automatic Test Generation<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">4.1. Randoop<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download Randoop into the&nbsp;tools&nbsp;folder from&nbsp;<a href=\"https:\/\/randoop.github.io\/randoop\/\">https:\/\/randoop.github.io\/randoop\/<\/a>&nbsp;. Note that the&nbsp;tools&nbsp;folder should be at the same level as the maven&nbsp;src&nbsp;folder.<\/li>\n\n\n\n<li>Create&nbsp;tools\/classes.txt&nbsp;file containing the target classes:&nbsp;edu.colostate.cs415.model.Qualification edu.colostate.cs415.model.Worker edu.colostate.cs415.model.Project edu.colostate.cs415.model.Company<\/li>\n\n\n\n<li>The classes for which you generated the tests must be listed in a file called&nbsp;classes.txt, which is in the same root folder as the&nbsp;tools&nbsp;folder.<\/li>\n\n\n\n<li>Run&nbsp;<code>java -cp \"tools\/randoop-all-4.3.2.jar:target\/classes\" randoop.main.Main gentests --classlist=tools\/classes.txt --time-limit=60<\/code> In Windows use&nbsp;;&nbsp;instead of&nbsp;:.<\/li>\n\n\n\n<li>Capture a screenshot (or log) showing that you generated the tests.<\/li>\n\n\n\n<li>Randoop may generate the test files in other folders. You must move the tests to appropriate folders corresponding to the packages and classes in the maven hierarchy.<\/li>\n\n\n\n<li>Capture a screenshot (or log) showing that you could run these generated tests (maven must not fail).<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h4 class=\"wp-block-heading\">4.2. Evosuite<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download Evosuite into the&nbsp;tools&nbsp;folder from&nbsp;<a href=\"https:\/\/www.evosuite.org\/\">https:\/\/www.evosuite.org\/<\/a>&nbsp;. This is the same&nbsp;tools&nbsp;folder that contains the jar file for&nbsp;randoop.<\/li>\n\n\n\n<li>Add dependency:&lt;dependency&gt; &lt;groupId&gt;evosuite&lt;\/groupId&gt; &lt;artifactId&gt;evosuite&lt;\/artifactId&gt; &lt;version&gt;1.0&lt;\/version&gt; &lt;scope&gt;system&lt;\/scope&gt; &lt;systemPath&gt;${project.basedir}\/tools\/evosuite-1.0.6.jar&lt;\/systemPath&gt; &lt;\/dependency&gt;<\/li>\n\n\n\n<li>Generate the tests by running\u00a0<code>java -jar tools\/evosuite-1.0.6.jar -prefix edu.colostate.cs415.model -projectCP target\/classes<\/code><\/li>\n\n\n\n<li>Capture a screenshot (or log) showing that you generated the tests.<\/li>\n\n\n\n<li>Evosuite may generate the test files in other folders. You must move the tests to appropriate folders corresponding to the packages and classes in the maven hierarchy.<\/li>\n\n\n\n<li>Capture a screenshot (or log) showing that you could run these generated tests (maven must not fail).<\/li>\n<\/ol>\n\n\n\n<p><strong>The log files\/screenshots for automatic test generation must be put in a document called reports\/P2_atg.md.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">5. Implementing RestController<\/h2>\n\n\n\n<p>You have already implemented the model classes. Now you will implement the controller class necessary to get ready for implementing the front end in the last sprint. The&nbsp;RestController&nbsp;class that you will implement feeds data to the front end using a&nbsp;DBConnector&nbsp;class, which could connect to a persistent storage.<\/p>\n\n\n\n<p>We have given you a sample&nbsp;DBConnector&nbsp;class that you should not touch. This class contains some canned data but in reality, it would actually retrieve data from a database. Since the&nbsp;RestController&nbsp;needs a&nbsp;DBConnector, to test the&nbsp;RestController&nbsp;you will &#8220;mock&#8221; a&nbsp;DBConnector&nbsp;in this sprint. Here are some important notes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;modify existing code.<\/li>\n\n\n\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;change exception handling.<\/li>\n\n\n\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;change logging.<\/li>\n\n\n\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;add public methods, exceptions, and classes. Only add private methods to the&nbsp;RestController.<\/li>\n\n\n\n<li>Use the provided endpoints as a guide to implement all other endpoints.<\/li>\n\n\n\n<li>Update the methods getQualifications() and getQualification(String description) to return the actual data from the company object.<\/li>\n\n\n\n<li>If a request cannot be satisfied, throw an exception. The exception handler will take care of the rest.<\/li>\n\n\n\n<li>GET requests do not have a body.<\/li>\n\n\n\n<li>When returning a DTO object, all fields must be initialized with the proper values.<\/li>\n\n\n\n<li>When receiving a DTO object as the body of a request, not all fields are initialized. This is specified below by \u201cBody required fields\u201d.<\/li>\n\n\n\n<li>DTO objects may contain a string field that represents a Qualification, or a Worker, or a Project. The string should contain their description or name. Do not use the toString, nor the JSON representation.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">5.1. Provided Endpoints<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Url: \/\nRequest type: GET\nReturn type: String\nReturn value: Hello World!\n\nUrl: \/helloworld\nRequest type: GET\nReturn type: String\nReturn value: Hello World!\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5.1.1. Qualifications<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Url: \/api\/qualifications\nRequest type: GET\nReturn type: JSON\nReturn value: QualificationDTO[]\n\nUrl: \/api\/qualifications\/:description\nRequest type: GET\nReturn type: JSON\nReturn value: QualificationDTO\n\nUrl: \/api\/qualifications\/:description\nRequest type: POST\nBody type: JSON\nBody value: QualificationDTO\nBody required fields: description\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">5.2. Endpoints to be Implemented<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">5.2.1. Worker<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Url: \/api\/workers\nRequest type: GET\nReturn type: JSON\nReturn value: WorkerDTO[]\n\nUrl: \/api\/workers\/:name\nRequest type: GET\nReturn type: JSON\nReturn value: WorkerDTO\n\nUrl: \/api\/workers\/:name\nRequest type: POST\nBody type: JSON\nBody value: WorkerDTO\nBody required fields: name, qualifications, salary\nReturn type: String\nReturn value: OK\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5.2.2. Project<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Url: \/api\/projects\nRequest type: GET\nReturn type: JSON\nReturn value: ProjectDTO[]\n\nUrl: \/api\/projects\/:name\nRequest type: GET\nReturn type: JSON\nReturn value: ProjectDTO\n\nUrl: \/api\/projects\/:name\nRequest type: POST\nBody type: JSON\nBody value: ProjectDTO\nBody required fields: name, qualifications, size\nReturn type: String\nReturn value: OK\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5.2.3. Company<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Url: \/api\/assign\nRequest type: PUT\nBody type: JSON\nBody value: AssignmentDTO\nBody required fields: worker, project\nReturn type: String\nReturn value: OK\n\nUrl: \/api\/unassign\nRequest type: PUT\nBody type: JSON\nBody value: AssignmentDTO\nBody required fields: worker, project\nReturn type: String\nReturn value: OK\n\nUrl: \/api\/start\nRequest type: PUT\nBody type: JSON\nBody value: ProjectDTO\nBody required fields: name\nReturn type: String\nReturn value: OK\n\nUrl: \/api\/finish\nRequest type: PUT\nBody type: JSON\nBody value: ProjectDTO\nBody required fields: name\nReturn type: String\nReturn value: OK\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">6. Testing RestController<\/h2>\n\n\n\n<p>In the previous iterations you tested every public method of the model classes. In this iteration you will write JUnit tests for every endpoint of&nbsp;RestController.<\/p>\n\n\n\n<p>While testing&nbsp;RestController, use Mockito to make&nbsp;DBConnector.loadCompanyData()&nbsp;return different values for different companies, projects, qualitifications, and workers since currently&nbsp;DBConnector&nbsp;only has a small set of fixed values.Here are some important notes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;modify the&nbsp;DBConnector&nbsp;class.<\/li>\n\n\n\n<li>Do&nbsp;<strong>not<\/strong>&nbsp;test the class&nbsp;DBConnector&nbsp;class.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">7. Installing Dependencies and Updating Maven Target<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">7.1. Mockito<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;dependency&gt;\n\t&lt;groupId&gt;org.mockito&lt;\/groupId&gt;\n\t&lt;artifactId&gt;mockito-core&lt;\/artifactId&gt;\n\t&lt;version&gt;4.11.0&lt;\/version&gt;\n\t&lt;scope&gt;test&lt;\/scope&gt;\n&lt;\/dependency&gt;\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7.2. HTTPClient5<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;dependency&gt;\n\t&lt;groupId&gt;org.apache.httpcomponents.client5&lt;\/groupId&gt;\n\t&lt;artifactId&gt;httpclient5-fluent&lt;\/artifactId&gt;\n\t&lt;version&gt;5.1.3&lt;\/version&gt;\n&lt;\/dependency&gt;\n<\/pre>\n\n\n\n<p>Find out more about HTTPClient 5&nbsp;<a href=\"https:\/\/hc.apache.org\/httpcomponents-client-4.5.x\/current\/tutorial\/html\/fluent.html\">here<\/a>.<\/p>\n\n\n\n<p>Use&nbsp;org.apache.hc.client5.http.fluent.Request&nbsp;to test your&nbsp;RestController.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">8. Grading criteria<\/h2>\n\n\n\n<p>Team scores will be based on both the product and the process. Individual adjustments will be made based on quality of contributions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8.1. Team scores<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Process component (25 points)\n<ol class=\"wp-block-list\">\n<li>Pull requests<\/li>\n\n\n\n<li>Issues<\/li>\n\n\n\n<li>Branches<\/li>\n\n\n\n<li>Commits<\/li>\n\n\n\n<li>Commits to main (Should be none)<\/li>\n\n\n\n<li>How the work is distributed across the sprint (waiting to work until the end is bad)<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Product component (75 points)\n<ol class=\"wp-block-list\">\n<li>Submission of mutation score report (5 points): We will grade your mutation score report (P2_mutation.md).<\/li>\n\n\n\n<li>Use of mutation score report to improve test cases. (5 points) This should be described in your document (P2_mutation.md).<\/li>\n\n\n\n<li>Static analysis report (10 points): We will review your before and after report (P2_sa.md).<\/li>\n\n\n\n<li>Tests automatically generated should compile and run (10 points). We will grade your atg report (P2_atg.md).<\/li>\n\n\n\n<li>Quality of your implementation (20 points): We will test your implementation of&nbsp;RestController&nbsp;using our test cases.<\/li>\n\n\n\n<li>Quality of your test cases (15 points): We will use faulty versions of the&nbsp;RestController&nbsp;and assess the ability of your&nbsp;RestControllerTest&nbsp;test cases to detect these faults. We will also collect and use data about the coverage and mutation score from GitHub.<\/li>\n\n\n\n<li>Quality of your implementation and tests with respect to each other (5 points): We will run your code against your tests and we expect all your tests to pass.<\/li>\n\n\n\n<li>Reflection report (5 points): We will grade your reflection (P2_reflection.md)<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">8.2. Individual Adjustments<\/h3>\n\n\n\n<p>Adjustments can be positive or negative up to 20 points and for reasons such as:low individual process score,bad peer reviews from teammates,gaming the system (e.g., purposefully increasing the number of commits without actually imlementing much functionality).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8.3. GitHub Actions<\/h3>\n\n\n\n<p>We use automated Github Actions to compile and tests the code that you push code to Github. You must never push broken code to the main branch, in other words you must never &#8220;break main&#8221;. Github Actions are one of the tools that we use to calculate your grade.&nbsp;You are not allowed to add\/modify\/delete any GitHub action, workflow, or workflow run.If you modify a workflow file, we are going to see it in the repository git history, and your team is going to lose points.If you delete a workflow run, we are going to see that there is a missing workflow run for a specific &#8216;git push&#8217;, and your team is going to lose points.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>P2. Sprint 2 ASSIGNED:&nbsp;5 March 2026DUE:&nbsp;11:59PM, Thursday, 9 April 2026 100 points 1. Objectives 2. Mutation Analysis Tool PIT Update your pom.xml to make PIT target only classes and tests inside the &#8216;model&#8217; package. Make sure the configuration of PIT inside your pom.xml looks like this: &lt;plugin&gt;\u2003&lt;groupId&gt;org.pitest&lt;\/groupId&gt;\u2003&lt;artifactId&gt;pitest-maven&lt;\/artifactId&gt;\u2003&lt;version&gt;1.10.4&lt;\/version&gt;\u2003&lt;configuration&gt;\u2003\u2003&lt;targetClasses&gt;\u2003\u2003\u2003&lt;param&gt;edu.colostate.cs415.model.*&lt;\/param&gt;\u2003\u2003&lt;\/targetClasses&gt;\u2003\u2003&lt;targetTests&gt;\u2003\u2003\u2003&lt;param&gt;edu.colostate.cs415.model.*&lt;\/param&gt;\u2003\u2003&lt;\/targetTests&gt;\u2003&lt;\/configuration&gt;&lt;\/plugin&gt; The workflow CI will produce mutation score information, [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","footnotes":""},"class_list":["post-95","page","type-page","status-publish","hentry","post-preview"],"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"ghosh","author_link":"https:\/\/courses.cs.colostate.edu\/cs415\/author\/ghosh\/"},"comment_info":0,"_links":{"self":[{"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/pages\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":6,"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/pages\/95\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/pages\/95\/revisions\/144"}],"wp:attachment":[{"href":"https:\/\/courses.cs.colostate.edu\/cs415\/wp-json\/wp\/v2\/media?parent=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}