Testing and handins

Testing and handins#

In VS Code, you can see the status of all tests by clicking on the science-flask in the activity bar, then navigate to your current exercise to see the status of all tests.

Attention

If you don’t see any tests, the most likely reason is that you did not quite follow the installation instructions. Most likely you did not run the installation command:

pip install -r requirements.txt

The first time you look at a test it will be gray, which indicate it has not been run. Right click on a test and select run to run the test: If it turns green, it means it has run correctly. If it turns red, it means there is a problem.

Running tests in VS Code

Why do we give you the tests like this?

There are different approaches to developing correct software. The most popular approach is test-intensive design, where developers continuously write tests to ensure their implementation (keeps) behaving as expected. Although this is not a course in writing tests (or software design), we believe that presenting you with tests in the (standard) format will implicitly teach you important skills about software developing. We would love to hear your oppinion on this aspect of the course, for instance on Discord (link to the left).

Handing in your project#

Attention

We recommend against using the _grade.py-script to debug your code. Although it will tell you when there is a problem, it does not work with the debugger, and it therefore makes it harder to fix the problems this way.

In the folder containing your project files, there will be a script which ends with _grade.py, for instance project1_tests_grade.py. To hand in, run the script, and upload the file it generates which ends with .token.

The .token-file contains the outcome of your tests, and more importantly, it contains all your source code in a reproducible format. Upload this file to DTU Learn to get credit for your results. The figure below shows both which file to run as well as the .token-file that it generates (in the right-most menu):

Generating a token file.