-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·67 lines (57 loc) · 2.04 KB
/
setup.sh
File metadata and controls
executable file
·67 lines (57 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# setup.sh - Environment Setup Script
# -----------------------------------------------------------------------------
# This script automates the setup process for the API Test Automation Framework.
# It performs the following tasks:
# 1. Validates Python installation
# 2. Creates/activates virtual environment (.venv)
# 3. Installs project dependencies
# 4. Sets up Allure reporting
# 5. Validates schema and data files
#
# Usage:
# ./setup.sh # Standard setup
# ./setup.sh --force # Force reinstall of dependencies
#
# Requirements:
# - Python 3.10 or higher
# - pip package manager
# - bash-compatible shell
# -----------------------------------------------------------------------------
set -e
echo "🚀 Setting up API Test Automation Framework"
echo "============================================"
# Check if Python 3 is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3.8 or higher."
exit 1
fi
# Display Python version
echo "🐍 Python version: $(python3 --version)"
# Create virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv .venv
echo "✅ Virtual environment created successfully!"
else
echo "📦 Virtual environment already exists."
fi
# Upgrade pip
echo "⬆️ Upgrading pip..."
.venv/bin/pip install --upgrade pip
# Install dependencies
echo "📚 Installing project dependencies..."
.venv/bin/pip install -r requirements.txt
# Verify installation
echo "🔍 Verifying installation..."
.venv/bin/python -c "import pytest, requests, allure, yaml, jsonschema; print('✅ All dependencies installed successfully!')"
echo ""
echo "🎉 Setup completed successfully!"
echo ""
echo "📋 Next steps:"
echo " 1. Run smoke tests: ./test_runner.sh smoke"
echo " 2. Run all tests: ./test_runner.sh all"
echo " 3. Generate report: allure serve reports/allure-results"
echo ""
echo "💡 Pro tip: Use the test runner for best experience!"
echo " ./test_runner.sh [category]"