Skip to content

aovsiyenko/iOSQEDemo

Repository files navigation

iOSQEDemo

An iOS demo project showcasing Quality Engineering (QE) best practices using XCtest, XCUITest, and SwiftUI.


📱 Project Overview

This project demonstrates:

  • 🧪 Unit Testing: Using XCtest for business logic validation.
  • 🎯 UI Testing: Using XCUITest with Page Object Model (POM).
  • 🔐 Environment Management: Using .env files for sensitive data.
  • 🚦 Best Practices: Test organization, maintainability, and modularity.

🚀 Getting Started

1. Prerequisites

  • Xcode 14+ installed on macOS.
  • iOS Simulator or a physical device.
  • Git for version control.

2. Clone the Repository

git clone https://github.com/aovsiyenko/iOSQEDemo.git
cd iOSQEDemo

3. Open the Project in Xcode

open iOSQEDemo.xcodeproj

4. Run the App

  • Select a simulator (e.g., iPhone 14).
  • Press Command + R to build and run the app.

5. Run Tests

  • Unit Tests:
Command + U
  • UI Tests: Run from the Xcode Test Navigator or using the diamond icons next to test methods.

🧑‍💻 Project Structure

iOSQEDemo/
├─ Source/                 # Main app code
├─ ViewModels/             # Business logic
├─ Tests/
│   ├─ UnitTests/          # Unit Tests with XCtest
│   └─ UITests/            # UI Tests with XCUITest
└─ .env                    # Environment variables

🧠 Key Concepts

1. XCtest (Unit Testing)

2. XCUITest (UI Testing)

3. SwiftUI

4. Environment Management


🧪 Running Tests

1. Unit Tests

Command + U
  • Navigate to LoginViewModelTests.swift under Tests/UnitTests.

2. UI Tests

  • Go to Tests/UITests.
  • Select LoginUITests.swift.
  • Run all tests or individual tests using the diamond icon.

🌳 Environment Variables

.env File Structure:

USERNAME=...
PASSWORD=...
INVALID_USERNAME=wronguser
INVALID_PASSWORD=wrongpassword

Add .env to .gitignore:

.env

🚦 Best Practices Followed:

  • Centralized Test Data: Using .env files.
  • Separation of Concerns: UI, business logic, and test code are separated.
  • Code Reuse: Page Object Model (POM) for UI testing.
  • Test Isolation: Each test method is independent.

💡 Additional Resources:


Author:

Alex Ovsiyenko

About

Demo project for XCTest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages