A Tutorial to guide testing on WebApp and enable CI/CD. The repository uses Python 3x and Django for demonstration.
First we will develop a simple web application that deals with funding for start up projects and then we shall apply testing methods to make the web application rock solid.
- Document based testing
- Unit Testing
- Integration Testing
- Functional testing.
- Install Python 3.7.x if needed
mkdir learn_django_test
cd learn_django_test
virtualenv --no-site-packages [--python=<path to python 3.x>] env
source env/bin/activate.csh #linux
env\Scrips\activate #windows
cd TestWebApp
pip install -r requirements.txt
cd startupmoney
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
python manage.py test
Note: db.sqlite3 ships with the git. To access the admin pages- user: admin, password: superuser
The idea of testing modules and atomic entities independently. Running unit tests:
python manage.py test handlemoney
- Refer handlemoney/tests/test_urls.py
- Refer handlemoney/tests/test_views.py
- Refer handlemoney/tests/test_forms.py
- Refer handlemoney/tests/test_models.py
- make chrome browser as the default browser
- install chromedriver. The version of the chrome can be found in the "About" section in the settings. Download the driver accordingly.
- copy the chromedriver.exe to functional_tests/ folder. For linux, use appropriate binary.
- Refer functional_tests/test_project_list_page.py
python manage.py test functional_tests
- https://pypi.org/project/robotframework-djangolibrary
- https://github.com/TheDumbfounds/budget-application-tutorial
- https://docs.djangoproject.com/en/2.1/topics/testing
- https://django-testing-docs.readthedocs.io/en/latest/basic_doctests.html
- https://selenium-python.readthedocs.io/getting-started.html