This post provides clarification on what to include in the Java files for the course CS-320 Software Testing Automation. The files are:
- Contact.java
- ContactService.java
- ContactTest.java
- ContactServiceTest.java
At first, I was unsure why the rubric requires four files to be submitted for a simple program, considering that no specific instructions were given on what to include in each file. Later, I realized that I needed to create two packages, one for the application and another for the JUnit tests.
I put Contact.java and ContactService.java in the application package I created and ContactTest.java and ContactServiceTest.java in the test package.
Contact.java
The Contact.java file is a class that has the following attributes:
- ID
- firstName
- lastName
- phoneNumber
- address
ContactTest.java
The ContactTest.java file implements JUnit methods to test the attributes of the Contact class. So, you would write one or several methods to test that the ID is not null, updateable, and less than or equal to 10 characters. You would also test the client’s requirements for firstName
, lastName
, phoneNumber
, and address
.
ContactService.java
The ContactService.java file implements a vector to store Contact objects and methods to add, update, and delete Contact objects using the ID attribute.
ContactServiceTest.java
The ContactServiceTest.java file implements methods to test the add, update, and delete methods in the ContactService class. For example, write a JUnit test to check that the add method in the ContactService works as expected. Lastly, Repeat this step for the update and delete method.
Hope that helped.