How to add an autograding test for R

Hi,

I’m interested in setting up an autograding test for an assignment in which the students develop some R code. I could imagine setting up some unit testing via RUnit or testthat, however, i don’t see how to integrate that into the autograding tool from GitHub classroom, because when i clic on “Add test” there is no option “Run R”.

Any hints, ideas or workarounds would be appreciated.

Thanks!

robert.

3 Likes

Choose “Run command” and run your test from the command line. In other words, set the test up using whatever command you would type in if you were running your tests from the command line.

@kurmasz is suggesting something along the lines of Rscript "nameOfTestFile.R" I believe (please correct me if I’m wrong on this).

An alternative solution would be to use Github Actions or Travis CI, by creating unit tests for each problem and running them using the R package testthat. I have something set up to teach Reproducible Research in R at my uni. Happy to share assignment files. Course repo here https://github.com/biol-4800/. If you figure out how to set up autograding easily within the assignment, please share. I think the user interface of the autograding may be better than what students wade through in the Travis CI builds I have .

@kurmasz @taddallas thank you for your hints. i don’t see how the “Run command” option ensures whether R is installed, what version of R is installed or how do i install additional packages that may be necessary for a successfull autograding. i was expecting that there is an option “Run R 4.0.x” with a textbox on some init R script to install the necessary packages.

anyway, i have moved forward with GHA, which means, we don’t get the class rooster in classroom.github.com indicating which student pass the test for a particular assignment and with how many points, but each student still gets to see whether his/her code passes one or more tests, which is ultimately the goal here.

you can find one such assignment with GHA running R (without additional packages), checking whether the script runs and whether specific CSV files are there, via md5 checksums, here:

You can add an optional “Setup” command. You would have to add commands to install R and other needed packages. If that’s not as simple as something like “apt get R”, then this may not be the best approach.

© 2017 GitHub, Inc.
with by
GitHub Education