Answered You can hire a professional tutor to get the answer.

QUESTION

Project 1 Unit Test Mission:

Project 1

Unit Test

Mission:

You were hired to design, write, and execute a complete unit test (white box testing) for MultiFunctionPrinter Java class, written by a developer who suddenly left the team. You are provided the source code (MultiFunctionPrinter.java) and you are to assume that code comments are correct for what each method is supposed to do and the code is supposed to match it.

Objectives and Steps:

You will complete this project in three different assignments, using the provided template, as follows:

1.    Assignment 1: Explain unit test approach and answer all questions in the template

a.     Fill out the Unit Test approach section in the template (section 1.1), explaining in your own words what unit test is all about and its most important criteria. You should demonstrate your understanding thorough understanding of unit test and its process.

b.    As part of your discussion, answer and discuss the following:

·      What are the goals and objectives for unit test?

·      What are the key criteria for unit test to be complete - how do you know you are done unit testing?

·      What kind of testing is unit test (black-box, white-box, boundary, etc.) and make sure to explain what that type of testing does?

·      What are code coverage and data coverage and how it relates to unit test?

·      What are test characteristics that you learned about in week 3 of this course? Name them and explain in your own words

·      Who normally writes and executes unit test?

·      How do you determine that a defect has been found in UT?

·      As defects are found during unit test who then fixes them?

·      What happens next after defect is fixed in the code being tested?

c.     Submit the report

2.    Assignment 2: Design unit test cases for 100% code coverage using statement coverage

a.     Incorporate the feedback provided in assignment 1 (make changes different color such as purple so I can easily review the updates)

b.    Design and document unit test cases in section 1.2 to meet 100% code coverage of MultiFunctionPrinter.java source code. Your test cases should test the expected behavior of the methods.

c.     You are not writing code yet but rather defining the test cases in English describing what they will test and how (use the test case format in the template section 1.2)

d.    The set of test cases should represent the minimal set needed for 100% code coverage, specifically 100% statement coverage (every line of code executed). There should be no redundancy where two test cases test exactly the same lines of code and add nothing more to the test suite relative to statement code coverage.

e.     Submit the report

3.    Assignment 3: Design unit test cases for reasonable data coverage

a.     Incorporate the feedback provided in assignment 2 (make changes different color such as blue so I can easily review the updates)

b.    Design and document unit test cases in section 1.3 for all the additional test cases you need to meet reasonable data coverage (all boundary, limits, clauses, and input) of MultiFunctionPrinter.java source code and anything else needed for unit test and not already designed under code coverage section. Your test cases should test the expected behavior of the methods. Do not repeat any code coverage test cases.

c.     Submit the updated report

4.    Assignment 4: Implement unit test cases using JUnit, execute, and document results

a.     Incorporate the feedback provided in assignment 3 (make changes different color such as green so I can easily review the updates)

b.    Implement all unit test cases that you defined in JUnit in a single Java file (e.g. TestMultiFunctionPrinter.java)

c.     Each test case should be a separate test method

d.    Run the unit test cases and document the defects your test cases have found in section 2 of the report. Note: You should find a number of defects. A defect is found when correctly implemented test case fails because the code being tested is not behaving as expected.

e.     Submit both the report file and JUnit source code

Testcases

Keep in mind that your JUnit testcases are to test the expected behavior of the code (based on the code comments) and not as it is actually working now. So that means that if you wrote your test case correctly and the test fails, you have found a defect in the source code. There are a number of deliberate defects that you are expected to find.

A reported defect that has no failing unit test case that found it will not get credit

Resources:

·      See SWEN647-P1-GradingSheet.doc for grading criteria.

·      You should review materials in week 1 and week 2 for information about testing and unit test in general.

·      You should review unit test examples in lecture charts (Week 3), Example.java and its test case files, and watch tutorial videos (Week 4).

Deliverables:

Use the Report template in LEO under Course Content->Projects->Project1 folder. The report must be submitted as an MS Word .doc. The name of the MS Word Report file shall be LastName_SWEN647_P1_AX.docwhere X is the number of the assignment such as 1, 2, 3, or 4. You will update the same project document for each assignment. You must also submit a separate Java file with your tests' source code for assignment 4. 

/*

 * Small class to practice writing JUnit tests 

 * Author: Renata Rand McFadden, PhD

 * Version 1

 */

public class MultiFunctionPrinter {

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question