- Cw2 utilises CRUD (Create, Read, Update, Delete) functions for a persistent storage application regarding questions, tests, results, classes, & users.
- Note: This tutorial uses an IDE called IntelliJ IDEA.
- Download the ZIP of this repository's master branch.
- Download a JavaFX SDK. They can be found here: https://gluonhq.com/products/javafx/. I recommend getting version 16 because that is what I used within development.
- Extract both downloaded ZIP files.
- Open the extracted OOP-Cw2-main folder > Open the Cw2 folder > Open the src folder > Open Main.java using IntelliJ IDEA.
- You should have opened OOP-Cw2-main\Cw2\src\Main.java in IntelliJ IDEA at this point.
- In IntelliJ, go to File > Project Structure.
- Go to the Libraries tab, press the add button and select Java.
- Go inside the extracted JavaFX SDK folder, open the javafx-sdk-16 folder & select the lib folder inside it.
- A dialog window as shown will appear, press OK.
- Now that you have added the JavaFX lib folder to the project structure, you can finalise the changes and exit the Project Structure window by pressing the OK button.
- On the top-right, press the Add Configuration... button.
- Then press Add new run configuration... and select Application
- You can give the name field any name you want it to use, I recommend Cw2 because it is a fitting name.
- In the Main class field, type Main.
- Press Modify options, then press Add VM options
- In the VM options field, paste this in
--module-path "\path\to\javafx-sdk-16\lib" --add-modules javafx.controls,javafx.fxml
. Change the path inside it to the one used for your extracted JavaFX lib folder. - For example you may want to use
--module-path "C:\Users\Administrator\Downloads\openjfx-16_windows-x64_bin-sdk\javafx-sdk-16\lib" --add-modules javafx.controls,javafx.fxml
if you extracted it in your downloads folder. - The final state of the window should look something like this:
- Press OK to finalise the configurations & exit the window.
- Press the green hammer button on the top-right to build it.
- Press the green play button on the top-right to run it.
- It should now be running & showing this screen on top of the IDE.
When you have run the application, it will start with a login screen. One SysAdmin is created by default, the username is Admin, and password is 123. It will let you through to where you can access the User Management tab. From there, you can make SysAdmin, Teacher and Student accounts. You can then log out and log back in as one the created accounts to test the functionality they have access to.
- Teachers have access.
This page is used for creating, editing, cloning and deleting questions (in the question bank).
- Teachers have access.
This page is used for creating, editing and deleting tests (in the test bank). When adding or editing a test, you can add and remove questions.
- Teachers have access.
This page is used for creating, editing and deleting classes (in the class bank). When adding or editing a class, you can add and remove users.
- Students have (limited) access.
- Teachers have access.
This page is used for viewing or editing the results (from the result bank), they can be done through the Open/Edit Selected Result button. Results can be deleted through the Remove Selected Result button.
- Students have access.
This page is used for doing a test. Once a test is finished, it will generate a result & save it into the result bank so it can be viewed/edited or deleted in the 'View Test Results' tab.
- Only SysAdmins have access.
This page is used for creating, editing and deleting users(in the user bank). This includes users of all types which is why it is only accessible to SysAdmins.
There are 9 JUnit test classes which contains 43 unit tests in total. All the unit tests are run against the classes stored inside the Quiz & 'Account packages. This includes the following classes from the Quiz package: Question, Test, Answer, Result & Class. Whereas from the Account package it includes testing the following classes: User, Student, Teacher & SysAdmin.
- To run all at once: Right click the UnitTests package and press Run 'Tests in 'UnitTests''.
- To run unit tests against a specific class: Right click the class you want unit tests ran against and press the Run 'nameOfClass'.
- All results from running unit tests should show up in the Run tab, letting you know if they passed or not.