Autograder
Automate the Way You Grade Code!
Main Tech Stack: Angular, Material UI, JUnit, Java SpringBoot and MongoDB
Visit the app at https://nidazaki.github.io/auto-grader-fe-13/
Screenshots
Architecture Diagram
FRONT-END
App Component
App Component interacts with the Ace Editor instances and the backend service, by initializing the code editors making a GET call by pulling the files from the database utilizing the lifecycle hook ngOnInit method for the instructor view.
For the student view, the App Component makes a GET call request to the server to get the list of functions (by parsing the java file from the database submitted by the instructor) and sets the code editor to display those functions, giving students a set of pre-defined functions to work with.
It makes use of ngAfterViewInit method to set up event listeners for the code editors, enabling editing the code and the test suite .
It handles code submission, making a POST call, saving the value from the code editors in a binary file format to the database, compiling and running the code displaying the results to the user.
It also handles user authentication via UserService Injectable, making a GET API call to fetch the logged-in user using Google O'Auth to support both instructor and student view.
Modal Component
Child component that displays a modal dialog box with a diff editor tool by making use of ngOnInit method to initialise the AceDiff editor, comparing two code snippets (student and instructor) and highlighting the differences between them.
BACK-END
InstructorController
Reads the code sent from the front-end as a multipart form value. Gets the code files from the database via the InstructorService to parse them into Java code to compare against student submissions and instructor's test cases.
Makes a save operation via Mongo driver to replace the older files with the latest code in Mongo collection.
Curates a response tailored for the front-end after the files are graded.
InstructorService
The service is responsible for compiling, processing files (with JUNIT), and morphing a JSON response.
The service acts as a bridge to do the following actions:
Create File objects for input and output files
Create InputStream objects to read the contents of the input files
Write the input file contents to the output files
Create Path objects from the File objects
Compile the files using the ProcessBuilder
Utilizes JavaParser to grab method names and associated Reflection items
Run JUnit tests on the compiled files using the ProcessBuilder class
Parse the output of the JUnit tests
Return a CodeResponse object with test status, test case list, grouped test cases, description, and output
Log any errors that occur during the process
Return appropriate status based on the outcome