testmycode / tmc-core

The common clientside implementation for tmc-clients. Used by the tmc-netbeans and the tmc-cli
3 stars 18 forks source link

tmc-core

Build Status Build status

Coverage Status

This is a library for the core functionalities of a TestMyCode client. The tmc-core uses tmc-langs for running tests locally, and supports fully the same languages as tmc-langs. Other features may be used with even languages other than those supported by tmc-langs, provided the tmc-server has such courses.

Features

Usage

The client should use the tmc core through a TmcCore object only. The TmcCore class provides a method for each of the features. The client will also have to implement the TmcSettings interface which holds maintains important information such as the users credentials and the tmc server address. The update checking feature requires a file for permanent storage of exercise checksums. This file must be given in the constructor of TmcCore or set separately. In some courses some of the exercises will not be visible to the student at first, so it is to be expected that new exercises appear.

All the methods of TmcCore will initiate a background task to and return a ListenableFuture containing the tasks result. Many of the returned results use classes defined in this library, and it is recommended the creator of a client familiarises themselves with these classes. The most important aspects of these classes is discussed below.

Course

A course using TMC. Some important fields:

Exercise

An exercise in a course. In current TMC implementations an exercise is a whole project, not just a few lines of code. Some important fields:

Review

A code review written by an instructor, for code submitted by the student. Some important fields:

SubmissionResult

The results of the serverside tests. Include points awarded to the student. If all serverside tests pass, the result will also have a list of feedbackquestions, if any have been set. Some important fields:

RunResult

The results of the local tests of this exercise. This is the same as the RunResult user by tmc-langs. Some important fields:

Examples

Creating an using tmc-core


TmcCore tmcCore = new TmcCore();
ListenableFuture<List<Course>> resultFuture = tmcCore.listCourses(mySettings);
resultFuture.addListener(courseListListener);

Tmc-core with a cache file


File cacheFile = getCacheFile();
// the file can be given in the constructor
TmcCore core = new TmcCore(cacheFile);

// or set later
core.setCacheFile(cacheFile);

When a TmcCore object has a cache file set it will automatically use this file with downloading and getting new updates. Download will write the checksums of the exercises, so that updates may be detected.


ListenableFuture<List<Exercise>> downloadedStuffFuture;
downloadedStuffFuture = core.downloadExercises(projectRoot, courseId, settings);
downloadedStuffFuture.addListener(projectOpeningListener);

ListenableFuture<List<Exercise>> newStuffFuture;
newStuffFuture = core.getNewAndUpdatedExercises(currentCourse, settings);
newStuffFuture.addListener(updateListener);

Credits

The tmc-core was initially created as part of the TMC commandline Client project, which was a Software Engineering lab project at the University Of Helsinki CS Dept.. The authors of TMC commandline Client were

The tmc-core was later separated and is maintained by the University of Helsinki CS Dept. Agile Education Research group.