Check your exercises using TestMyCode

What is TestMyCode (TMC)?

TestMyCode (or TMC for short) is a tool that enables you to submit your Python code for automatic grading.

TMC has a command line interface, which may be accessed through the Terminal application in JupyterLab.

To get started with TMC, follow the instructions below.

Logging in to TMC

To use TMC, you need to first register as a user on the mooc.fi website.

Next, open a new Terminal from the JupyterLab Launcher to access the command line interface.

A view of JupyterLab.
_images/empty.png

To log in to TMC, type the command tmc login on the command line and press ⏎ to execute the command.

A view of the TMC command line interface.
_images/empty.png

TMC will prompt you for your e-mail address or username.

Enter the e-mail or username that you registered on the mooc.fi website and press ⏎.

A view of the TMC command line interface.
_images/empty.png

Next, type in your password for the mooc.fi platform and press ⏎.

Important

The cursor will not move when you type into the password prompt, but your password is still being entered.

A view of the TMC login screen on the command line interface.
_images/empty.png

If the login is successful, TMC will prompt you to select an organization.

A view of the TMC command line interface.
_images/empty.png

Use the arrow keys ↑↓ to navigate the list and choose the MOOC organization. Press ⏎ to confirm your selection.

Next, TMC will prompt you to select a course.

Again, use the arrow keys ↑↓ to navigate the list and choose Working with Text in Python or Natural Language Processing for Beginners depending on the course that you wish to take. Press ⏎ to confirm your selection.

This downloads the exercises into a directory named mooc-wtp (Working with Text in Python) or mooc-nlp (Natural Language Processing for Linguists), depending on the course that you chose above. The directory should be visible in the JupyterLab File Browser.

Downloading and updating exercises

TMC will automatically download any missing exercises on your server when you log into the system.

To download exercises manually, open a Terminal and type the command tmc download and press ⏎.

TMC will prompt you to select a course.

Use the arrow keys ↑↓ to navigate to Working with Text in Python or Natural Language Processing for Beginners and press ⏎ to confirm your selection.

A view of the TMC command line interface.
_images/empty.png

This will download all available exercises into the exercise directory.

If instructed to do so, you can also update the exercises by typing tmc update and pressing ⏎.

A view of the TMC command line interface.
_images/empty.png

This will update all exercises available to you.

Completing the exercises

To complete the course exercises, use the JupyterLab File Browser to enter the directory that contains the exercises.

Each directory contains subdirectories, which hold the individual exercises. A new exercise will become available for download via TMC when you have received 80% of the points available for the previous exercise.

Open the Jupyter Notebook in the subdirectory and follow the instructions provided in the notebook.

When you want to check your solutions to the exercises, see the instructions below.

Testing your code locally

After completing an exercise in a Jupyter Notebook, you can test your code by following the steps below.

In this context, testing refers to evaluating whether the Python code you wrote produces the expected output.

To get started, save the Jupyter Notebook by entering the File menu and selecting Save Notebook, or click the save icon at the top of the Notebook.

Next, close the Jupyter Notebook.

Open a new Terminal from the JupyterLab Launcher to access the command line interface.

To test your code, type the command tmc test and press ⏎.

A view of the TMC command line interface.
_images/empty.png

TMC will prompt you to select a course.

Use the arrow keys ↑↓ to navigate to mooc-wtp (Working with Text in Python) or mooc-nlp (Natural Language Processing for Linguists) and press ⏎ to confirm your selection.

Next, TMC will prompt you to select an exercise to test.

Use the arrow keys ↑↓ to navigate the list, select the exercise you want to test and press ⏎.

TMC evaluates your solutions to the exercise and prints out the result, which includes the points given for the exercise.

Open the Jupyter Notebook that contains the exercise to see feedback on your code.

Tip

Instead of closing the Jupyter Notebook, you can simply save the Notebook, run the command tmc test in a Terminal and hit the reload button on your browser to see the feedback written to the Notebook.

Unfortunately, JupyterLab does not automatically refresh Notebooks that have been modified. This also applies to TMC, which modifies the Notebook when adding feedback.

Remember to submit your code to the TMC server when you are done with an exercise to register any points.

Submitting your code to the server

When you are finished with an exercise, you must submit your code to the TMC server for grading and registering the points.

Tip

You can submit your code to the TMC server even if it does not pass all local tests.

To submit your code to the TMC server, open a Terminal and type the command tmc submit and press ⏎.

A view of the TMC command line interface.
_images/empty.png

Use the arrow keys ↑↓ to select the course you are currently taking and press ⏎ to confirm your selection.

Next, TMC will prompt you to select an exercise to submit.

Use the arrow keys ↑↓ to navigate the list, select the exercise you want to submit and press ⏎.

The server will run the tests and return information on any points awarded for the submission.

Important

All points from the exercises are awarded permanently. Even if you submit an incorrect solution to the TMC server afterwards, the points you have earned will not be deducted.

You can monitor your overall progress by visiting mooc.fi and viewing your profile information.

To view your profile, click your e-mail address / username in the top right-hand corner.

Requesting a completion for your coursework

To request your work to be graded and marked as complete on mooc.fi, open the exercise named grade_my_work on your server, follow the instructions in the Jupyter Notebook and return the exercise to TMC.

The instructor will then check your coursework and mark it as complete on mooc.fi.