|
| 1 | +# ✅ Todo Application Test Automation Framework |
| 2 | +[]([https://github.com/OmarElsheikh1/selenium-todo-testing-framework/actions](https://github.com/OmarElsheikh1/todo-app-qa-task/actions)) |
| 3 | + |
| 4 | + |
| 5 | +[](https://docs.oracle.com/en/java/javase/21/) |
| 6 | +[](https://www.selenium.dev/documentation/) |
| 7 | +[](https://rest-assured.io/) |
| 8 | +[](https://testng.org/) |
| 9 | +[](https://maven.apache.org/) |
| 10 | +[](https://docs.qameta.io/allure/) |
| 11 | + |
| 12 | +A comprehensive automation framework for testing a Todo application, covering both UI workflows and API endpoints with robust test cases and reporting capabilities. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## 🚀 Features |
| 17 | +Hybrid Testing: UI tests with Selenium WebDriver + API tests with RestAssured |
| 18 | + |
| 19 | +Multi‑Environment: Easily switch between local, staging, and production via properties |
| 20 | + |
| 21 | +Page Object Model: Separation of page logic from test logic for maintainability |
| 22 | + |
| 23 | +Allure Reporting: Interactive test reports and failure screenshots |
| 24 | + |
| 25 | +Parallel Execution: Thread‑safe WebDriver via ThreadLocal |
| 26 | + |
| 27 | +Data‑Driven: Dynamic test data generation with JavaFaker |
| 28 | + |
| 29 | +## 📁 Framework Structure |
| 30 | +```root/ |
| 31 | +├── src/ |
| 32 | +│ ├── main/ |
| 33 | +│ │ └── java/com/omarelsheikh/todo/ |
| 34 | +│ │ ├── api/ |
| 35 | +│ │ │ ├── config/ # API endpoints |
| 36 | +│ │ │ └── models/ # API POJOs |
| 37 | +│ │ ├── drivers/ # WebDriver factory |
| 38 | +│ │ ├── models/ # Domain models (Todo, User) |
| 39 | +│ │ ├── pages/ # Page Object classes |
| 40 | +│ │ └── utils/ # Config + properties management |
| 41 | +│ └── test/ |
| 42 | +│ └── java/com/omarelsheikh/todo/ |
| 43 | +│ ├── api/ |
| 44 | +│ │ ├── requests/ # API call wrappers |
| 45 | +│ │ ├── testcases/ # API test cases |
| 46 | +│ │ └── utils/ # API helper utilities |
| 47 | +│ ├── base/ # Shared BaseTest class |
| 48 | +│ ├── ui/ |
| 49 | +│ │ └── testcases/ # UI test cases |
| 50 | +│ └── utils/ # Test data utilities |
| 51 | +├── resources/ |
| 52 | +│ └── config/ |
| 53 | +│ ├── local.properties |
| 54 | +│ └── production.properties |
| 55 | +``` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## 🛠 Technologies Used |
| 60 | + |
| 61 | +- **Languages**: Java 17+ |
| 62 | +- **Testing Frameworks**: TestNG, RestAssured |
| 63 | +- **Web Automation**: Selenium WebDriver 4.0+ |
| 64 | +- **Reporting**: Allure Framework |
| 65 | +- **Dependency Management**: Maven |
| 66 | +- **Test Data**: JavaFaker |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +## Test Coverage |
| 71 | + |
| 72 | +### API Tests |
| 73 | +- ✅ Authentication (Login/Logout) |
| 74 | +- ✅ Todo CRUD operations |
| 75 | +- ✅ Error handling (400/401/404 responses) |
| 76 | +- ✅ Data validation |
| 77 | +- ✅ Authorization checks |
| 78 | + |
| 79 | +### UI Tests |
| 80 | +- ✅ User registration and login |
| 81 | +- ✅ Todo management (add/complete/delete) |
| 82 | +- ✅ Form validation |
| 83 | +- ✅ Session management |
| 84 | +- ✅ Error message verification |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## ▶️ Getting Started |
| 89 | + |
| 90 | +### ✅ Prerequisites |
| 91 | +- Java 17 JDK |
| 92 | + |
| 93 | +- Maven 3.8+ |
| 94 | + |
| 95 | +- Chrome, Firefox or Edge installed |
| 96 | + |
| 97 | +### 🛠️ Installation |
| 98 | + |
| 99 | +1. Clone the repository |
| 100 | +```bash |
| 101 | +git clone https://github.com/your-username/todo-test-automation.git |
| 102 | +``` |
| 103 | + |
| 104 | +2. Navigate to the project directory |
| 105 | +```bash |
| 106 | +cd todo-test-automation |
| 107 | +``` |
| 108 | + |
| 109 | +3. Install dependencies |
| 110 | +```bash |
| 111 | +mvn clean install |
| 112 | +``` |
| 113 | + |
| 114 | +4. Configure environments |
| 115 | +Edit the file based on the target environment: |
| 116 | +```route |
| 117 | +src/test/resources/config/local.properties or production.properties |
| 118 | +``` |
| 119 | + |
| 120 | +Example: |
| 121 | +```properties |
| 122 | +baseUrl = https://todo.qacart.com |
| 123 | +email = omar-production@qatask.com |
| 124 | +password = Test1234 |
| 125 | +``` |
| 126 | + |
| 127 | +### ▶️ Run Your Tests |
| 128 | +By default, tests run on Chrome using the production environment: |
| 129 | + |
| 130 | +```bash |
| 131 | +mvn clean test |
| 132 | +``` |
| 133 | + |
| 134 | +You can also customize: |
| 135 | + |
| 136 | +Change browser: |
| 137 | + |
| 138 | +```bash |
| 139 | +mvn clean test -Dbrowser=firefox |
| 140 | +mvn clean test -Dbrowser=edge |
| 141 | +``` |
| 142 | + |
| 143 | +Change environment: |
| 144 | +```bash |
| 145 | +mvn clean test -Denv=local |
| 146 | +``` |
| 147 | + |
| 148 | +Use both: |
| 149 | +```bash |
| 150 | +mvn clean test -Dbrowser=firefox -Denv=production |
| 151 | +``` |
| 152 | + |
| 153 | +### 📊 View the Allure Report |
| 154 | +After running the tests: |
| 155 | + |
| 156 | +```bash |
| 157 | +allure serve allure-results |
| 158 | +``` |
| 159 | +This will open an interactive test report in your browser. |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## 💡 Key Snippets |
| 164 | + |
| 165 | +### Hybrid Flow: API → UI |
| 166 | +```java |
| 167 | +Copy |
| 168 | +Edit |
| 169 | +// Register via API |
| 170 | +RegisterApi registerApi = new RegisterApi(); |
| 171 | +registerApi.register(); |
| 172 | + |
| 173 | +// Inject cookies into the browser session |
| 174 | +injectCookiesToBrowser(registerApi.getCookies()); |
| 175 | + |
| 176 | +// Continue with UI tests |
| 177 | +TodoPage todoPage = new TodoPage(driver); |
| 178 | +todoPage.load(); |
| 179 | +``` |
| 180 | + |
| 181 | +### Environment Configuration |
| 182 | +```java |
| 183 | +String env = System.getProperty("env", "PRODUCTION").toUpperCase(); |
| 184 | +switch (env) { |
| 185 | + case "PRODUCTION": |
| 186 | + properties = load("production.properties"); |
| 187 | + break; |
| 188 | + case "LOCAL": |
| 189 | + properties = load("local.properties"); |
| 190 | + break; |
| 191 | + default: |
| 192 | + throw new RuntimeException("Environment not supported"); |
| 193 | +} |
| 194 | +``` |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## 🚦 Best Practices Implemented |
| 199 | +Separation of Concerns: API, UI, and test layers cleanly divided |
| 200 | + |
| 201 | +Singleton Config: Centralized environment config loading |
| 202 | + |
| 203 | +Thread Safety: ThreadLocal<WebDriver> for parallel runs |
| 204 | + |
| 205 | +Fluent Interfaces: Chainable page object methods |
| 206 | + |
| 207 | +Robust Reporting: Allure annotations, steps, and screenshots |
| 208 | + |
| 209 | +Data Generation: Randomized test data with JavaFaker |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## 🤝 Contributing |
| 214 | +1. Fork the repository |
| 215 | + |
| 216 | +2. Create a feature branch: |
| 217 | +```bash |
| 218 | +git checkout -b feature/your-feature |
| 219 | +``` |
| 220 | + |
| 221 | +3. Commit your changes: |
| 222 | + |
| 223 | +```bash |
| 224 | +git commit -m "Add: brief description" |
| 225 | +``` |
| 226 | + |
| 227 | +4. Push and open a Pull Request |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +## 🤝 Contact |
| 232 | + |
| 233 | +If you have any questions, suggestions, or want to collaborate, feel free to reach out. |
| 234 | + |
| 235 | +📧 omar1999.elsheikh@gmail.com |
| 236 | +🔗 [LinkedIn](https://www.linkedin.com/in/omar-elsheikh1999/) |
0 commit comments