Git Product home page Git Product logo

generic-test-runner's Introduction

Exercism Test Runner Template

This repository is a template repository for creating test runners for Exercism tracks.

Using the Test Runner Template

  1. Ensure that your track has not already implemented a test runner. If there is, there will be a https://github.com/exercism/<track>-test-runner repository (i.e. if your track's slug is python, the test runner repo would be https://github.com/exercism/python-test-runner)
  2. Follow GitHub's documentation for creating a repository from a template repository
    • Name your new repository based on your language track's slug (i.e. if your track is for Python, your test runner repo name is python-test-runner)
  3. Remove this Exercism Test Runner Template section from the README.md file
  4. Replace TRACK_NAME_HERE with your track's name in the README.md file
  5. Replace any occurances of exercism/test-runner with exercism/<track>-test-runner (e.g. exercism/python-test-runner)
  6. Build the test runner, conforming to the Test Runner interface specification.
    • Update the files to match your track's needs. At the very least, you'll need to update bin/run.sh, Dockerfile and the test solutions in the tests directory
    • Tip: look for TODO: comments to point you towards code that need updating
    • Tip: look for OPTIONAL: comments to point you towards code that could be useful

Once you're happy with your test runner, open an issue on the exercism/exercism to request an official test runner repository for your track.

Exercism TRACK_NAME_HERE Test Runner

The Docker image to automatically run tests on TRACK_NAME_HERE solutions submitted to Exercism.

Run the test runner

To run the tests of an arbitrary exercise, do the following:

  1. Open a terminal in the project's root
  2. Run ./bin/run.sh <exercise-slug> <solution-dir> <output-dir>

Once the test runner has finished, its results will be written to <output-dir>/results.json.

Run the test runner on an exercise using Docker

This script is provided for testing purposes, as it mimics how test runners run in Exercism's production environment.

To run the tests of an arbitrary exercise using the Docker image, do the following:

  1. Open a terminal in the project's root
  2. Run ./bin/run-in-docker.sh <exercise-slug> <solution-dir> <output-dir>

Once the test runner has finished, its results will be written to <output-dir>/results.json.

Run the tests

To run the tests to verify the behavior of the test runner, do the following:

  1. Open a terminal in the project's root
  2. Run ./bin/run-tests.sh

These are golden tests that compare the results.json generated by running the current state of the code against the "known good" tests/<test-name>/results.json. All files created during the test run itself are discarded.

When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new tests/<test-name>/results.json file.

Run the tests using Docker

This script is provided for testing purposes, as it mimics how test runners run in Exercism's production environment.

To run the tests to verify the behavior of the test runner using the Docker image, do the following:

  1. Open a terminal in the project's root
  2. Run ./bin/run-tests-in-docker.sh

These are golden tests that compare the results.json generated by running the current state of the code against the "known good" tests/<test-name>/results.json. All files created during the test run itself are discarded.

When you've made modifications to the code that will result in a new "golden" state, you'll need to generate and commit a new tests/<test-name>/results.json file.

generic-test-runner's People

Contributors

bobbicodes avatar cmccandless avatar dependabot[bot] avatar ee7 avatar erikschierboom avatar exercism-bot avatar glennj avatar kytrinyx avatar larshp avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

generic-test-runner's Issues

The master branch will be renamed to main

In line with our new org-wide policy, the master branch of this repo will be renamed to main. All open PRs will be automatically repointed.

GitHub will show you a notification about this when you look at this repo after renaming:

Screenshot 2021-01-27 at 15 31 45

In case it doesn't, this is the command it suggests:

git branch -m master main
git fetch origin
git branch -u origin/main main

You may like to update the primary branch on your forks too, which you can do under Settings->Branches and clicking the pencil icon on the right-hand-side under Default Branch:

Screenshot 2021-01-27 at 18 50 08

We will post a comment below when this is done. We expect it to happen within the next 12 hours.

bin/run-tests-in-docker.sh does not work correctly

$ bin/run-tests-in-docker.sh 
Sending build context to Docker daemon  411.6kB
Step 1/4 : FROM alpine:3.10
3.10: Pulling from library/alpine
21c83c524219: Pull complete 
Digest: sha256:f0e9534a598e501320957059cb2a23774b4d4072e37c7b2cf7e95b241f019e35
Status: Downloaded newer image for alpine:3.10
 ---> be4e4bea2c2e
Step 2/4 : COPY . /opt/test-runner
 ---> 5368510b2d94
Step 3/4 : WORKDIR /opt/test-runner
 ---> Running in 7636731d45cf
Removing intermediate container 7636731d45cf
 ---> 3d0a0916d927
Step 4/4 : ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
 ---> Running in c6bc940c71a9
Removing intermediate container c6bc940c71a9
 ---> 4537cafcc220
Successfully built 4537cafcc220
Successfully tagged generic-test-runner:latest
--entrypoint: testing...
--entrypoint: processing test output in /opts/test-runner/bin/run-all.sh...
--entrypoint: copying processed results to /solution/...
cp: can't stat '/opts/test-runner/bin/run-all.sh/results.json': No such file or directory

Clarify the container running environment about offline and read-only

Back in February, we had an issue for the elm-test-runner related to the fact that the elm compiler is writing a lock file inside ~/.elm/ and that folder used to be read-only (exercism/elm-test-runner#1 (comment)).

We were advised to test the container by using docker run --network none --read-only inside the run-in-docker.sh script. I don't see such options in that script in this template repo. Are those network and read-only requirements been removed since back in February? Having ~/.elm/ being writable in particular would help simplify our run.sh script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.