CI/CD pipeline using Jenkins, Docker, Python, and Pytest for automated testing.
Akshay Kumar TN
- Jenkins (Docker)
- Python 3
- Pytest
- Git/GitHub
jenkins-python-pytest-demo/
├── docker-compose.yml # Jenkins container configuration
├── requirements.txt # Python dependencies
├── Jenkinsfile # Pipeline configuration
└── tests/
└── test_sample.py # Pytest test cases
docker compose up -d- URL: http://localhost:8080
- Get password:
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassworddocker exec -it jenkins bash
apt-get update && apt-get install -y python3 python3-venv python3-pip
exit- New Item → Pipeline
- Configure with GitHub repository
- SCM: Git
- Repository URL: https://github.com/AkshayKumarTN/jenkins-python-pytest-demo
- Branch: */master
- Script Path: Jenkinsfile
Click "Build Now" and view results
- ✅ 2 tests pass:
- test_addition
- test_subtraction
- ❌ 1 test fails (intentional):
- test_failure_example (demonstrates failure reporting)
- Install dependencies - Creates Python virtual environment
- Run tests - Executes pytest with JUnit XML reporting
- Publish Report - Displays test results in Jenkins
See deliverables folder for:
- Jenkins pipeline stage view
- Test results showing passes and failures
- Console output