CS 320 - 4-2 Journal-Unit Testing Approach and Writing JUnit Tests
.docx
keyboard_arrow_up
School
Southern New Hampshire University *
*We aren’t endorsed by this school
Course
320
Subject
Industrial Engineering
Date
Dec 6, 2023
Type
docx
Pages
2
Uploaded by bradbucher
4-2 Journal
Unit Testing Approach and Writing Junit Tests
7/23/2023.
-
To what extent was your testing approach aligned to the software requirements? Support your
claims with specific evidence.
As a result of those being the test settings, the testing strategy complied with the software
requirements. To ensure that the code was constructed successfully, tests were put up and the code
was constructed using the specified parameters. The first name in the contact class could not be null
or longer than ten characters, according to the guidelines. Both conditions were examined in the two
Junit tests for the first name. In the first test, an exception was set up to be thrown if the name was
longer than ten characters, whereas in the second test, an exception was set up to be thrown if the
name was null.
-
Defend the overall quality of your JUnit tests for the contact service and task service. In other
words, how do you know that your JUnit tests were effective on the basis of coverage
percentage?
After turning in my project, I found certain mistakes that I have since fixed, considerably enhancing
the caliber of my Junit tests. The ContactTest class has a coverage of 52.8%, however the code that is
not executed is the one that causes the mistake. The Contact class also has a coverage of 97.5%,
which I consider to be effective. I received 100% coverage for the ContactServiceTest class and a
100% coverage for the ContactService class. I believe my testing was successful overall.
-
How did you ensure that your code was technically sound? Cite specific lines of code from your
tests to illustrate.
I only utilized the necessary amount of code to satisfy the requirements. Testing for updating, null
values, adding, and deleting was successful. The code was written with best practices and proper
naming conventions in mind to guarantee that it was technically sound. To make it simple to
distinguish between the tests, in the example below, the test names indicated which section of code
was under test. The ContactServiceTest class test for true and false add method assertions is also
demonstrated in the example below. Making ensuring the code is effective and functioning as
intended involves testing for both true and incorrect assertions.
4-2 Journal
Unit Testing Approach and Writing Junit Tests
7/23/2023.
-
How did you ensure that your code was efficient? Cite specific lines of code from your tests to
illustrate.
Every time there were repeated lines of code in my code, I utilized functions to make sure it was
efficient. For instance, I made functions to verify the length and character validity of variables. In
order to check conditionals and throw any necessary problems, I additionally used if/else
statements. To make sure all the requirements were met, I tested my code using several scenarios.
This can be observed when determining whether the provided phone number is too long, too short,
or contains letters.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help