Installation and Usage
Prerequisites
Note
You should have installed Python 3 and pip3 installed.
Mosquitto Broker Installation
First of all, you should have installed mosquitto. To install it, go to their official website and download and install the Mosquitto Broker for your OS.
For Ubuntu/Debian:
Install Mosquitto using:
sudo apt update
sudo apt install mosquitto
To check whether the service is running or not and to start it, run:
sudo systemctl status mosquitto # Checking if the service is running
sudo systemctl start mosquitto # Start the service
For Mac OS:
Install Mosquitto on Mac OS using Homebrew:
brew install mosquitto
For Windows (WSL):
To install Mosquitto on Windows Subsystem for Linux (version 2), use the same
commands as the ones for the Ubuntu/Debian installation (if you’re using a
Ubuntu/Debian WSL distribution). To run the broker with systemctl, you have to
run your WSL shell with systemd, because WSL does not start with it by default.
You can check out this tutorial on how to start your WSL with systemd. After
this step, you can run the same commands as the ones in the Ubuntu/Debian
installation steps to check if the broker is running or start it.
Installation
Create a virtual envirionment using
python3 -m venv venv
Activate the envirionment using
.\venv\Scripts\activate # for Windows
source venv/bin/activate # for Unix
Install the requirements from
requirements.txtusing
(venv) pip install -r requirements.txt
Select development mode for server:
(venv) export FLASK_ENV=development
Usage
To start the MQTT Broker service run:
mosquitto
or
sudo systemctl start mosquitto
To run the Flask server, start it with:
(venv) python app.py
Swagger API
To access the Swagger API, access http://localhost:500/apidocs/ and enjoy all of your oven’s features.
Testing
You can run our tests by:
Starting the MQTT Broker service by running:
mosquitto
Activating the environment using
.\venv\Scripts\activate # for Windows
source venv/bin/activate # for Unix
We created 32 unit tests. You can run them by using this command in the project root folder:
pytest tests-unit/
If you want to run the unit tests and check the code coverage you can run:
cd ..
pytest --cov=SmartOven SmartOven/tests-unit/
You can find our results here.
We created 2 intergation tests. You can run them by using this command in the project root folder:
If you want to run the intergation tests and check the code coverage you can run:
cd ..
pytest --cov=SmartOven SmartOven/tests-integration/
You can find our results here.
Automation Tests
To run the automation tests provided for this project, you should have a Postman account and access this link to run them. Select the environment coresponding to the collection you want to run and after than, select a collection and choose Run collection.