Testing and Quality Assurance - benhall/flask-demo

Testing and Quality Assurance (QA) are crucial processes in software development to ensure that the software functions correctly and meets the specified requirements. In the context of the Flask demo project located at https://github.com/benhall/flask-demo/, we will cover the possible testing options and provide examples for each option using the provided documentation and code snippets.

Unit Testing

Unit testing is a type of testing where individual units or components of the software are tested in isolation to ensure they function correctly. In the Flask demo project, unit testing is implemented using the pytest library, as shown in the tests/test_app.py and tests/test_app_single.py code snippets.

Here’s an example of a unit test in tests/test_app.py:

def test_homepage(client):
res = client.get("/")
assert res.status_code == 200
assert b"Welcome to the Flask App!" in res.data

In this example, the test_homepage function tests the homepage of the application by sending a GET request and checking the response status code and content.