Skip to content
Snippets Groups Projects
Commit 5b097fd5 authored by Rafi Zereselasie (raz070)'s avatar Rafi Zereselasie (raz070)
Browse files

Added a testing suite in the main method

parent fdc1e627
No related branches found
No related tags found
No related merge requests found
...@@ -253,7 +253,7 @@ public class Staff { ...@@ -253,7 +253,7 @@ public class Staff {
} }
// Staff testing suite // Staff testing suite
// This test suite must be started while the staff table is empty. // This test suite must be started with an empty Employees and Positions tables.
public static void main(String[] args) { public static void main(String[] args) {
try { try {
Connection dbConnection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ScheduleApp", "root", "password"); Connection dbConnection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ScheduleApp", "root", "password");
...@@ -264,9 +264,9 @@ public class Staff { ...@@ -264,9 +264,9 @@ public class Staff {
String queryString; String queryString;
int queryInt; int queryInt;
int success = 0; int success = 0;
System.out.println("Staff Testing Suite:");
System.out.println("\nStaff Test 1: ");
System.out.println("Staff Test 1: ");
System.out.println("Test Scenario: " + "Testing allEmployees()"); System.out.println("Test Scenario: " + "Testing allEmployees()");
System.out.println("Test Data: " + "none"); System.out.println("Test Data: " + "none");
System.out.println("Expected Results: " + "allEmployees"); System.out.println("Expected Results: " + "allEmployees");
...@@ -335,7 +335,7 @@ public class Staff { ...@@ -335,7 +335,7 @@ public class Staff {
System.out.println("Pass/Fail: Fail"); System.out.println("Pass/Fail: Fail");
} }
//Setup to test removePositionAllEmployees() properly //Setup to properly test removePositionAllEmployees()
staff.addEmployee("Jane", "Doe", "false", "jane.doe@email.com", staff.addEmployee("Jane", "Doe", "false", "jane.doe@email.com",
"1234567890", 10.0f); "1234567890", 10.0f);
staff.addPosition(2, "cashier"); staff.addPosition(2, "cashier");
...@@ -352,7 +352,6 @@ public class Staff { ...@@ -352,7 +352,6 @@ public class Staff {
System.out.println("Actual Results: " + queryString); System.out.println("Actual Results: " + queryString);
if (queryString.equals("allEmployees/1,Jonathan,Deer,0,jonathan.deer@email.com,0987654321,15.0,null/2,Jane," + if (queryString.equals("allEmployees/1,Jonathan,Deer,0,jonathan.deer@email.com,0987654321,15.0,null/2,Jane," +
"Doe,0,jane.doe@email.com,1234567890,10.0,null")){ "Doe,0,jane.doe@email.com,1234567890,10.0,null")){
success += 1; success += 1;
System.out.println("Pass/Fail: Pass"); System.out.println("Pass/Fail: Pass");
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment