This project demonstrates automated testing for a Django application using Appium and MySQL as the database. The setup uses Docker and Docker Compose for containerization.
- Prerequisites
- Installation
- Environment Configuration
- Running Tests
- Stopping the Application
- Troubleshooting
- License
Ensure you have the following installed on your system:
- Docker
- Python 3.x
- Appium (for mobile testing)
-
Clone the repository:
git clone https://github.com/PydevAzmi/django-appium.git cd django-appium
-
Set up the virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Python dependencies:
pip install -r requirements.txt
-
Build and run Docker containers:
docker-compose up --build
If you need to apply migrations manually:
docker-compose exec web python manage.py migrate
You need to configure the environment variables before running the application.
modify the docker-compose.yaml
and .env
files for configuring the database, and more.
The setup uses MySQL. The connection details are managed in the docker-compose.yaml
file. Update these settings as needed:
environment:
MYSQL_ROOT_PASSWORD: your_password
MYSQL_DATABASE: django_db
MYSQL_USER: user
MYSQL_PASSWORD: password
Create a .env
file in the root directory of your project with the following variables:
# Database settings
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=db
DB_PORT=3306
# Django settings
DJANGO_SECRET_KEY=your_secret_key
DJANGO_DEBUG=True
To run the automated Appium tests:
-
Ensure the requirements is running inside the your computer (Appium, Android Emulator, adb server).
-
Run the test script using:
Will run local for now
python automated_test.py
To stop and remove all containers:
docker-compose down
- MySQL Connection Issues: Ensure that the MySQL server is running and the credentials in settings.py are correct.
- Appium Issues: Use appium-doctor to diagnose and fix issues with your Appium setup.
- Virtual Environment Issues: If you encounter problems with package installations, make sure your virtual environment is activated.
- If you want to contribute to this project, please create a new branch and submit a pull request.
- This project is licensed under the MIT License. See the LICENSE file for more details.