- Linux
- Google Chrome
- Python 2.7
- pip
https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv
Install virtualenv package:
$ pip install virtualenv
Create virtualenv:
$ virtualenv .env
Activate virtualenv:
$ source .env/bin/activate
$ pip install -r requirements.txt
Dowanload latest Chromedriver from: http://chromedriver.chromium.org/downloads
Unzip package and move chromedriver
binary to .env/bin
Introduction: http://pythontesting.net/framework/unittest/unittest-introduction/
Documentation: http://docs.python.org/2/library/unittest.html
Assertions methods: https://docs.python.org/2/library/unittest.html#unittest.TestCase
$ python -m unittest discover test
Introduction: http://pythontesting.net/framework/pytest/pytest-introduction/
$ pytest -s test
Note that pytest
auto-detects also unittest-based test cases.
Introduction: https://selenium-python.readthedocs.io/getting-started.html
Documentation: https://seleniumhq.github.io/selenium/docs/api/py/api.html
$ python demoapp/server.py
Try to login with username demo
and password mode
and with invalid credentials.
$ cd selenium && python test_login.py
Take a look at screeenshots in selenium/reports
folder.
def test_valid_login(self):
"""TODO: valid login scenario"""
pass
def test_invalid_login(self):
"""TODO: invalid login scenario"""
pass
Doc: http://flask.pocoo.org/docs/1.0/testing/
$ python test_client/app.py
Open http://localhost:5000/ui and try out sample Rest API
$ pytest test_client
def test_get_pets_on_empty_db(client):
result = client.get('/pets')
assert result.status_code == 200
assert result.json == []
def test_put_pet(client):
# TODO: Pet creation scenario
pass
Website: http://robotframework.org/
User guide and standard libraries docs: http://robotframework.org/robotframework/
Selenium library: http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html
$ python demoapp/server.py
$ pybot -d robot/results robot