targets 0.7.9+1

  • Installing
  • Versions
  • 0


Build Status

Targets is an assignment manager and autograder intended for high school CS classes that uses GitHub to download assignment templates.

This README describes the fundamentals of using Targets. Full documentation intended for teachers and students is also available, though it is currently a draft and is subject to change.

targets get example downloads an example assignment from

You can download assignments you create with targets get username/assignment which would download from

Starting in 0.7.0, Targets can download assignments from any zip archive that is publicly accessible on the web. Just use:

targets get assignment-name

If you want to use an assignment someone else has created (but have submissions sent to you), add your username and a colon. targets get userA:userB/assignment downloads from but alters the tests.dart file so that submissions are sent to userA.

Creating Templates

To create a new assignment template, you can download a fully commented version of an existing template with targets init. This command will download the example template I've created. You can add an assignment argument to download some other assignment.

targets init works almost exactly the same as targets get, except that it leaves comments in the tests.dart file untouched. //, /*, and /** style comments are kept with either command, but unindented /// comments are removed when using targets get. The example template includes many of these comments to explain the structure of tests.dart.

Once you've completed your assignment template, push it to a new GitHub repository. The repo name should start with targets-. Students can then download your new assignment with targets get user/id when user is your GitHub username and id is everything after the targets- in your repo name.

Starting in 0.7.4, you can keep templates in subdirectories of GitHub repositories. For example, an ID like user/assign/dirA/dirB refers to a Targets template in the subdirectory dirA/targets-dirB within the GitHub repo at The assignment will be downloaded to a directory called assign-dirA-dirB. You should use this for the id field of tests.dart. This allows you to add a Targets template to an existing repository or include multiple Targets templates in the same repository.

If you would prefer to keep your assignment templates private, you can instead put the template in a zip file (with the root of the template at the root of the zip) and share the URL with your students. Note that in this case, you cannot share the same zip with other teachers as Targets will not modify the owner property in tests.dart. If you want to share assignments, post them to GitHub (it also makes them easier for your students to download).

Submission and Grading

Students can run the tests on their assignment with targets check and submit with targets submit (after first running targets setup). Student submissions are validated with a Google account (the primary email of the account must match the one their enter in targets setup).

Submissions are made to the GitHub user or organization name set in the owner variable of tests.dart. Once submissions have been uploaded, you can view and download them here by logging into your GitHub account.

Once you download a zip of submissions, you can run tests on all them with targets batch. Just put a version of your assignment template with more rigorous tests into a folder called template within the extracted zip file. targets batch will output a log of tests on all submissions to log.txt.

Starting in 0.7.3, you can download submissions from the command line with targets submissions username/assignment. This will require that you create an OAuth key for GitHub, but then you can set up a directory to run targets batch with just one command.

Additionally, if you open the submission viewer in Dartium, you can paste in code from a tests.dart file to run tests of Dart code without downloading submissions. Please note that this feature works best with very simple assignments. When all code is in one file, it should work fine. It should theoretically work with multiple files, as long as they are all uploaded with students' submissions, but things may break. If the web grader does not work, just download the zip and use targets batch.

For the time being, the submission service is free of charge. The server is running on "unlimited" shared hosting, so I shouldn't have any issues keeping it free, unless demand is such that I go beyond whatever my host deems "unlimited" to be. To keep the server lightweight, all submissions will be deleted after 30 days. Make sure to download the zip archive within that window or your students will have to resubmit.

Similarity Detection

Starting in 0.6.0, Targets supports easy submission of student code to Moss for similarity detection. You can run targets moss on any set of student submissions that you can run targets batch on. Once you enter the command, you'll be prompted for the language your students' code is in, the file extension to submit, and your Moss account ID. In addition to student code, Targets will also upload code in template to Moss to improve accuracy by providing a baseline. Once Moss responds, your web browser will open with the results.

Languages Other Than Dart

Targets is best suited for testing Dart code. However, version 0.2.3 added support for IOTarget, which lets you test output for given input sent to a program. To see an example of how IOTarget works, targets init java-example. I've tested simple examples on both OSX and Windows, but testing more complex programs may result in some issues, particularly cross-platform. If you use IOTarget, make sure to use targets check on a completed version of your template on each OS that your students may use.

Prior to 0.7.2, IOTarget tests could not be scored. With the new properties for TestTarget (which IOTarget extends) in 0.7.2, each IOTarget can add an all-or-nothing amount of points to the total score.

For obvious reasons, IOTarget is not supported by the web grader, though targets batch should work fine.

Web Interface

Since targets is primarily intended for high school CS courses (there's much better software out there for universities), you may not want your students to have to access targets from the command line, both because command line programs can be daunting to high school students and because your school's IT department may not want to provide command line access to students.

To allow student use of targets outside of the command line, version 0.5.0 adds the targets gui command. This starts a local web socket server on the student's machine and opens their web browser to From here, students can download assignments, run tests, and submit their work without touching the command line. There's even a button to upgrade targets through pub (though this may not work on all setups).

Downloading templates from the zip files using the web console is supported as of 0.7.6.

By default, the local server is hosted on port 7620 (fun fact: this number was reached by adding the ASCII codes of the letters in "targets" and multiplying by 10). You can customize it with targets gui #, where # is your preferred port. If using the default interface URL, the default port will automatically be changed in the page that launches by adding "?port=#" to the end.

The source of the web interface is included in the pub package and on GitHub if you want to customize it. To have Targets launch your new version, use targets gui # You can put your custom in a shell script to allow your students to launch the interface with one click.

Sample Project: Enigma

In addition to a few small templates hosted on the dart-targets GitHub, I'm currently developing a large sample project for Targets in which students build an Enigma machine simulator and then attempt to break the code. The project is hosted here. Draft templates are currently available in Dart and Java. A Python version is under development.


You can install targets with:

pub global activate targets

You may be prompted by pub to add a directory to your path. Obviously, Dart should also be on your path. Previous versions of Targets required Git to download assignment templates, but, starting in 0.7.0, templates are instead downloaded from the zip archive of the project that GitHub provides.

The code is available on GitHub under the revised BSD license.


  • Fixed bug in IOTarget.make and IOTarget.makeMulti that broke tests on InputOutput objects with arguments.


  • Add support for excluding specific files from extension wildcard by adding a ! before the file
  • See targets get dart-targets/enigma/java for an example
  • Slight changes to output of IOTarget


  • Fix error when downloading templates from subdirectories of repos
  • Fix issues with subdirectories in web console
  • Fix issues with subdirectories in targets submissions command
  • Minor bug fixes


  • Proper support for downloading from zip files using the web interface.


  • Internal cleanup
  • Minor bug fixes
  • Switch to returning futures to allow easier testing


  • Targets template can now be stored in subdirectories of repos
  • Just like user/assign refers to, user/assign/dir1/dir2 refers to dir1/targets-dir2 within
  • This allows you to include a Targets assignment within an existing repository or keep multiple assignments in the same repository.
  • Major code refactoring
  • Minor changes to the command-line interface


  • New targets submissions command, which allows you to download student submissions from the console


  • New scoring option for TestTargets. Set points to a value greater than 0 to add that many points of the test returns true.
  • New uncounted option for all targets. Set this property to true and the test is counted as extra credit.
  • This now means that IOTargets can be scored, though their points are all-or-nothing.
  • InputOutput objects (used for creating IOTarget tests) now have optional parameters for points and uncounted in their constructors
  • Minor bug fixes


  • New targets template command that works like targets init, but downloads to a folder called template (for later use with targets batch)
  • New targets distribute command which takes a folder set up for targets batch and creates a folder for each submission that contains the student code on top of the template (if you want to manually run anything on student code that requires template files)
  • Update from web console no longer requires Targets to be on the path (only pub needs to be)


  • Rewrites targets get to eliminate the need for Git to be installed on student machines.
  • Adds support for zip file templates with targets get if you don't want to host your assignments on GitHub.
  • tester.dart and helpers.dart are now re-added before every targets check or targets submit command to ensure students do not modify them
  • The IOTarget Java helper methods should now properly compile classes in packages.
  • Errors during IOTarget pre-test commands (usually compilation) now halt the testing process, even if there are other tests left to run. Previously (in 0.6.0), errors in compilation only failed the one test.


  • New targets moss command
  • Allows teachers to send student code that's prepared for targets batch to [Moss][] for similarity detection
  • IOTargets now fail when any pre commands fail. This will ensure that students are notified about compile-errors in their code


  • Improved IOTarget.makeJava
  • Breaks existing use of IOTarget.makeJava
  • Adds additional helpers in IOTarget


  • Fixes bugs with updating through the student GUI


  • Adds student GUI to targets, launched with targets gui
  • This runs a local web socket server and opens in your browser
  • The web interface connects to the local web socket server to allow easy access to student commands without using the terminal (you could write a simple script to run targets gui)
  • Minor improvements to downloading templates with git


  • Fixes bug with browser opening on submit on Windows introduced in 0.4.0


  • Fixed issue with submitting large amounts of data with targets submit
  • Added option to submit all files of a certain type (include "*.extension" as on the strings in the files list in your tests.dart file)


  • Added targets batch command, which allows for testing multiple submisssions at once.
  • Improved documentation
  • Submissions can now be viewed here


  • Added IOTarget, which allows testing of other languages. For an example in Java, download the java-example assignment with targets get or targets init


  • Fixed issues; should work on OSX, Windows, and Linux now


  • First release

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate targets

2. Use it

The package has the following executables:

$ targets

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  targets: ^0.7.9+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:targets/gui.dart';
import 'package:targets/helpers_text.dart';
import 'package:targets/moss.dart';
import 'package:targets/student.dart';
import 'package:targets/submit.dart';
import 'package:targets/targets_cli.dart';
import 'package:targets/teacher.dart';
import 'package:targets/tester_text.dart';
import 'package:targets/utils.dart';
Version Uploaded Documentation Archive
0.7.9+1 May 20, 2015 Go to the documentation of targets 0.7.9+1 Download targets 0.7.9+1 archive
0.7.9 May 18, 2015 Go to the documentation of targets 0.7.9 Download targets 0.7.9 archive
0.7.8 May 14, 2015 Go to the documentation of targets 0.7.8 Download targets 0.7.8 archive
0.7.7 May 9, 2015 Go to the documentation of targets 0.7.7 Download targets 0.7.7 archive
0.7.6 Apr 28, 2015 Go to the documentation of targets 0.7.6 Download targets 0.7.6 archive
0.7.5 Apr 25, 2015 Go to the documentation of targets 0.7.5 Download targets 0.7.5 archive
0.7.4+1 Apr 18, 2015 Go to the documentation of targets 0.7.4+1 Download targets 0.7.4+1 archive
0.7.4 Apr 18, 2015 Go to the documentation of targets 0.7.4 Download targets 0.7.4 archive
0.7.3 Apr 11, 2015 Go to the documentation of targets 0.7.3 Download targets 0.7.3 archive
0.7.2 Apr 4, 2015 Go to the documentation of targets 0.7.2 Download targets 0.7.2 archive

All 40 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 Because targets depends on args >=0.2.8+2 <1.4.4 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format bin/targets.dart.

Run dartfmt to format bin/targets.dart.

Format lib/gui.dart.

Run dartfmt to format lib/gui.dart.

Format lib/helpers_text.dart.

Run dartfmt to format lib/helpers_text.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/moss.dart (Run dartfmt to format lib/moss.dart.)
  • lib/student.dart (Run dartfmt to format lib/student.dart.)
  • lib/submit.dart (Run dartfmt to format lib/submit.dart.)
  • lib/targets_cli.dart (Run dartfmt to format lib/targets_cli.dart.)
  • lib/teacher.dart (Run dartfmt to format lib/teacher.dart.)
  • lib/tester_text.dart (Run dartfmt to format lib/tester_text.dart.)
  • lib/utils.dart (Run dartfmt to format lib/utils.dart.)

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Package is too old. (-100 points)

The package was released more than two years ago.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use targets.dart.