Define implement and execute complete and thorough unit


Mission:

You were hired to write and execute complete unit test (white box testing) for MyStringUtils Java class, written by a developer who suddenly left the team. You are provided the source code (MyStrings.java) and you are to write JUnit test cases for it. 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:

Define, implement, and execute complete and thorough unit test on the given Java class (MyStringUtils.java).

Outline of Steps:

1. Fill out the Unit Test approach section in the template, explaining what unit test is all about and it's most important criteria. Make sure you answer and discuss all the questions in the template.

2. Design tests for each method to meet 100% code coverage and reasonable data coverage. Describe these tests in the document using template format given. For this project you want to test methods against the code comments and the code itself.

3. Implement unit test cases in JUnit in a single Java file (e.g. testMyStringsUtils.java)

4. Run the unit test cases and document the actual results in the report for each test case

5. Identify any defects you found running the JUnit and describe them in the report (using the template format) in section 2. Note: You should find a number of defects.

6. Submit both the report file and JUnit source code.

Again, you should first identify and document in your report all the unit tests that should be created (using the example in report). That will give you partial credit - identifying the tests. Then you should implement those test cases in JUnit. Use a single Java file for all your tests! Lastly you should run the test cases and document the actual results and defects you found.

Notes on pulling source code into eclipse

1. Create a new Java project: File->New->Java Project  (ex. MyProject1)

2. Click on "src" under your new project; right click and select import

3. Click on General->File System, then next and browse for where you have the file MyStringUtils.java, select it and click Finish

4. As an alternative you could create a new class MyStringUtils and copy/paste the file content into it.

5. In your project, you will see the source file MyStringUtils.java under src directory.

To add JUnit library to your Eclipse project:

1. Right click on project and select Properties

2. Click on Java Build Path (left side list)

3. Click on "Add Library" button (right side)

4. Select JUnit and click next

5. Choose version 4 of Junit and click Finish

6. The JUnit library will now show under Libraries tab.

7. Click OK

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Define implement and execute complete and thorough unit
Reference No:- TGS01227090

Now Priced at $50 (50% Discount)

Recommended (98%)

Rated (4.3/5)

A

Anonymous user

2/20/2016 7:43:23 AM

The assignment is basically to define, implement and run complete and comprehensive unit test on the provided Java class (MyStringUtils.java). To complete the assignment, there are some steps to be outlined. 1) Fill out the Unit Test approach part in the template, describing what unit test is all about and it's most significant criteria. Ensure you answer and describe all the questions in the template. 2) Design tests for each and every method to meet up 100% code coverage and reasonable data coverage. Illustrate these tests in the document by using template format given. For this project you wish for to test methods against the code comments and the code itself. 3) Execute unit test cases in JUnit in a single Java file (example: testMyStringsUtils.java) 4) Run the unit test cases and document the real results in the report for each and every test case. 5) Recognize any defects you found running the JUnit and illustrate them in the report (by employing the template format)