How to use JUnit 4?

How to use JUnit 4?

Using JUnit tests can be very helpful if you want to test your students' code with unit tests written by you or your students. To use JUnit with AutoGradr, you need to create a project. Set the 'Test Case Type' to 'Unit Tests'.

Add a prompt to your project like you normally would for any other project.

To run the JUnit tests, AutoGradr requires the entrypoint to be TestRunner.java. Create a file called TestRunner.java with the class TestRunner and add all your tests in it. Now, upload this file in the 'Test Case Files' drop box. You can create multiple test cases with different versions of TestRunner.java. As always, you can hide some test cases from your students.

Finally, when creating an assignment, remember to select 'JUnit 4' under 'Select Languages'. Do not select any other language.

That's it! Check out a sample JUnit 4 project here

results for ""

    No results matching ""