Role: Automation QA
Domain: Web application testing
- Stack -
Python3, Selenium, PyTest
- Project Overview -
Automated UI tests in Python3 for web apps, tested on platforms such as Tumblr, Twitter and client’s app. By simply having locators for the web page elements, tests can be created with ease, which is especially helpful for client-side testing. This approach aligns well with test-driven development and is highly effective for end-to-end testing.
- Challenges & Solutions -
The main challenge was to make this codebase as user-friendly as possible. Think of the web application as a book, where each webpage is a page in the book, and elements on the page are like words and sentences.
Page Object Model (POM) Layer: Each page or section of a web application has a corresponding class representing its elements and actions. This layer abstracts page functionality from test scripts, promoting reusability and readability.
Page Elements as Property Descriptors: Page elements defined as properties to encapsulate locator logic. Property descriptors use getter and setter methods to manage dynamic behaviors of elements (like waiting, clicks, input, etc.), keeping the page objects cleaner and more intuitive.
WebDriver Factory: The WebDriver factory is responsible for managing WebDriver instances based on browser requirements, configurations, or environment variables. By centralizing this management, we streamline browser setup, avoid redundancy, and make it easy to switch browsers when needed.
Data Transfer Object (DTO): DTOs are for separating data handling from the POM logic. They simplify passing structured data to page objects and allow for better handling of input data, especially with parameterized tests or data-driven testing. DTOs also improve flexibility and reduce dependencies within tests.
- Reflections & Takeaways -
- Cross-browser Testing:
-
Reflection: Implementing a cross-browser testing strategy using a single test suite improved efficiency and ensured that the web application performed consistently across different browsers.
-
Takeaway: Maintaining compatibility across browsers can significantly reduce potential user experience issues.
- Reusable Test Initialization:
-
Reflection: The use of pytest fixtures for base setup and login, as it streamlined the process and minimized repetitive code, enhancing overall maintainability.
-
Takeaway: Investing in reusable components early on promotes scalability and efficiency in test automation, saving time and effort in the long run.
- Structured Test Flow:
-
Reflection: The Given/When/Then structure facilitated clear and logical test scenarios, making tests easier to understand and maintain. It also helped in communicating the test cases effectively to non-technical stakeholders.
-
Takeaway: A well-defined test structure is essential for collaboration and ease of maintenance. The BDD-style approach is effective in aligning the team and making the test cases more accessible to clients and team members.