v0.2.1 Creating Labs for JUnit Tests
- Please have your solution ready before you begin the solution setup on AutolabJS.
- For the sake of clarity, we will assume that you are planning to evaluate for
Setup of a matching gitlab repository is mandatory before a lab evaluation is setup on AutolabJS. Please follow the steps given below to create and setup a lab solution on gitlab.
Login to gitlab as
lab_author. In case you have not created an account with username of
lab_authorbefore, please do so before going to the next step.
Create a gitlab repository for the lab. You can create a new gitlab repository by clicking on New Project button. After successful creation of a project repository, Gitlab creates a URL for the project.
https://autolab.bits-goa.ac.inshall have a URL of
Clone the gitlab repository onto your local machine.
$ export GIT_SSL_NO_VERIFY=1 $ git clone https://firstname.lastname@example.org/lab_author/lab1.git
This step clones the gitlab repository into lab1 directory of the present working directory.
Create skeleton structure
Create the following directory structure in the local copy of git repository.
author_solution ---> contains the complete solution to the lab /java ---> contains Java-language solutions /lib ---> contains any third-party Java libraries you would like to use for evaluation test_cases/ ---> contains testcases to be run against submitted code /checks ---> any sample input / output text files to be used for evaluation /java/ ---> test cases for Java language /setup ---> compile, execute and test-setup bash shell scripts compile.sh ---> script to compile the code for each test (DON'T CHANGE THIS) executeTest.sh ---> script to execute the code for each test (DON'T CHANGE THIS) Test1.sh ---> script to complete first test (calls compile.sh, executeTest.sh) (one script for each test case) /tests ---> contains the java-language test files for each test Test1.java ---> test file that runs a test. This file is indirectly called by Driver.java (one language-specific sub-directory exists under test_cases) support_files.sh ---> script to copy required files for evaluation (DON'T CHANGE THIS) Driver.java ---> Language driver for Java (DON'T CHANGE THIS) (one driver exists for each language) execute.sh ---> orchestrating script for one submission (DON'T CHANGE THIS) test_info.txt ---> text file containing an enumeration of all tests to be run
You can see the sample directory structure in unit_tests. All the files that have DON'T CHANGE tag in the above listing have to be copied from unit_tests. The other files can be copied and modified according to your needs.
test_casesdirectories, there is one language-specific sub-directory. One language-specific driver file exists at the top-level. Please copy the needed driver file(s) from unit_tests. You can evaluate C, C++ 2011, C++ 2014, Python2, and Python3 languages.
Apart from the above directory structure, when the evaluation happens three more directories are created by AutolabJS. They are:
student_solution ---> the submitted code gets copied here working_dir ---> a temporary directory used during evaluation results ---> results of evaluation are stored in this directory /log.txt ---> evaluation log is in this file /scores.txt ---> scores received for all the test cases /comments.txt ---> comments received for all the test cases
Copy the solution
Copy the lab solution into
author_solution/java. Any required third-party libraries need to be copied to
Create List of Tests
test_info.txtfrom unit_tests and modify to suit your needs. Each line of
test_info.txthas two fields separated by a tab space. A sample
test_info.txtwith two tests is shown below.
Test1 1 Test2 1
The first field corresponds to name of the test and the second field corresponds to time limit to run the test. The last line ends without any new line character.
A test should have four matching parts.
- Required solution and library files in
- A test setup shell script (ex: test_cases/java/setup/Test1.sh)
Each test setup script has a copy section which helps copy the necessary files from
- A Java test class (ex: test_cases/java/tests/Test1.java)
- An entry in test_info.txt file (ex: Test1 1).
Please refer to unit_tests for sample setup. Repeat the above mentioned four steps for all the tests
- Required solution and library files in
save and export the solutions to gitlab
Make a commit in the local repository and push the changes to the gitlab.
$ git add . $ git commit -m 'instructor's solutions' $ git push origin master
Follow the details provided on Manage Course page to add the lab to website.