This is a TDD tutorial (or a game) of the basic web programming.
Come and pass tests, cross the gate one by one, you will become a web developer.
Python 2 or 3 (recommended) with pip
is required.
pip install pytest requests
After your server is started, make sure it listens to the port 8888
.
Read the test cases in tests/test_*.py
, and learn from error messages.
Try to pass all the tests:
pytest
Of course, this is not a good move for newbies. You are going to be inundated by error messages. Please take small steps forward.
It is not so easy to passing all tests. You can cross it one by one.
pytest -m gate00
# or
pytest -m gate01
# more
pytest -m gate00,gate01
The gates:
gate00
: Run a server, returnHello world!
.gate01
: 3 simple ways to handle the arguments from clients.gate02
: Receive and return with JSON.
pydoc
can provide more information, like:
pydoc tests.test_gate00
You can see the name of test cases in pytest
.
You can run it alone with its name.
pytest tests/test_gate01.py::test_002_gender
# or with parameters
pytest tests/test_gate01.py::test_002_gender[Alice-Female]
It is recommended to fork this repository,
then create branches named as flask
, django
and so on to keep your implementations.
It is tested in Python, but implementations could be any framework in any language.
A pull request is welcome if you have any idea about this repository.
There are some programming languages for newbies:
There are some web frameworks for newbies:
Flask is used when test cases are developing.