Test Automation¶
Test automation is a process where pre-written tests can be executed without human intervention to ensure that the software behaves as expected. Its essence: the machine performs repetitive, structured testing tasks that are time-consuming or error-prone when done manually.
Purpose:
- stable, repeatable test execution
- fast feedback on changes
- prevention of regressions
- lower long-term testing cost.
Regression tests
A regression test is an automated or manual test that verifies whether a new development, fix, or modification has broken any previously working functionality. Its essence: ensuring that the system continues to work correctly after changes.
Not the purpose of test automation:
- afully replacing manual testing
- automating every single test..
Test types: recap
Functional tests: * Unit test * Integration test * End-to-end (E2E) test * API test
Non-functional tests: * Performance test * Load and stress test * Security test
White-box / black-box / gray-box: * White-box: performed with knowledge of code structure * Black-box: only input–output is visible * Gray-box: partial internal knowledge
Good candidates for automation:
- stable features
- frequently repeated tests
- regression tests
- API tests
- data-driven checks
Not worth automating:
- highly changing UI
- one-time checks
- exploratory testing
- tests requiring visual experience.
Test Automation Pyramid¶

Layers of Testing Tools¶
- Test framework: (JUnit, PyTest, NUnit, Jest, Mocha, PHPUnit, etc.)
- Test runner: (maven-surefire, pytest runner, npm test)
- Automated UI framework: (Selenium, Cypress, Playwright)
- API testing framework: (REST Assured, Karate, Postman/Newman)
- CI/CD integration: (GitHub Actions, GitLab CI, Jenkins)
Test Automation Patterns and Methodologies¶
Page Object Model (POM)¶
A traditional and well-established architecture for UI tests.
- Each page is a separate class
- The class contains locators and actions
- The test calls only these actions
Goal: clean code, stable tests, easy maintenance.
Data-driven testing¶
Test data stored in separate files:
- CSV
- JSON
- Excel
- database
The test repeats automatically with multiple data pairs.
Behavior Driven Development (BDD)¶
Gherkin
1 2 3 | |
Tools:
- Cucumber: https://cucumber.io/
- Behave: https://behave.readthedocs.io/en/latest/
- SpecFlow: https://www.specflow.com/
Test Automation Process¶
- Reviewing requirements and specifications
- Selecting test cases for automation
- Tool selection
- Building the framework
- Writing the tests
- Preparing test data
- Integrating into CI/CD
- Reporting test results
- Maintenance and refactoring
Example API Test (Python: Pytest + Requests)¶
1 2 3 4 5 6 7 8 | |
Example UI Test (Selenium)¶
1 2 3 4 5 6 7 8 9 10 11 12 | |
CI/CD Integration (classic model)¶
Jenkins / GitLab CI:
- push → automatic build
- unit tests run
- application deployed to dev environment
- integration tests run
- finally E2E execution
- report generation (Allure, HTML)

Example report:

Quality Assurance Metrics¶
- Test coverage
- Defect detection rate
- Test execution time
- Test stability
- Flaky test ratio
- Mean time to repair (MTTR)
Most Common Test Automation Mistakes¶
- Too many E2E tests
- Unstable locators (e.g., overly long XPath)
- Trying to fully automate manual tests
- Automating tests with low business value
- Mixing test data
- Ignoring flake errors
- Incomplete architecture (e.g., missing POM)
Flake
A flake error = a test that behaves non-deterministically: the same test sometimes passes and sometimes fails due to external or hidden factors.
Practical Applications¶
Swagger¶
The material related to Swagger is available here.
Playwright¶
The material related to Playwright is available here.
Selenium¶
The material related to Selenium is available here.