alexmojaki / futurecoder

100% free and interactive Python course for beginners
https://futurecoder.io/
MIT License
1.27k stars 132 forks source link

Increase test coverage in the backend #137

Open alexmojaki opened 3 years ago

alexmojaki commented 3 years ago

The tests mostly cover the golden paths, i.e. users getting steps right or triggering a message step. There's lots of untested code. It can be found pretty easily by running tests with coverage. Some stuff is tested by test_frontend but that's slow and more difficult to measure coverage for so we should have pure Python tests for it. I'm particularly interested in the edge cases of bad code submissions from users, e.g:

harimm commented 2 years ago

Are these tests for the 'core' module? Where are the existing tests located? I have seen some tests based on selenium which is for front end

alexmojaki commented 2 years ago

It's all under tests. test_frontend uses selenium, the other two test code within core. The tests described in the issue would be a bit like test_steps but more targeted.

BTW the 'backend' used to be a Django server, now it just refers to core which runs in the browser in Pyodide. But you shouldn't need to know anything about Pyodide to write and run these kinds of tests, regular 'local' Python and pytest should work.