Skip to content

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Cloud Pricing Calculator Automation

Overview

This project provides a Selenium + TestNG automation framework for testing Google Cloud's Pricing Calculator and disposable email functionality. It supports automated generation of compute engine estimates, sharing via temporary email, and verification of the estimate consistency.

The framework is modular, with clearly defined page objects, models, utils, drivers, and data providers for scalable tests automation.


Features

  • Navigate Google Cloud and interact with the Pricing Calculator
  • Fill Compute Engine configurations dynamically via data providers
  • Generate pricing estimates and verify calculated costs
  • Share estimates via disposable email services
  • Validate email inbox accessibility and received emails
  • Utilities for browser tab management, clipboard, logging, and screenshots
  • Multi-browser support (Chrome, Firefox, Edge) via WebDriverManager

Software Design & Architecture Patterns

This project was deliberately refactored to apply object-oriented design principles and proven design patterns, improving maintainability, extensibility, and test isolation. Below is a summary of the key patterns used and the problems they solve.

Factory Pattern

Used in: DriverFactory, EmailPageFactory

Purpose: Decouple object creation from usage.

  • Centralizes WebDriver instantiation logic, separating browser creation from lifecycle management.
  • Simplifies creation of complex page objects related to email functionality.
  • Makes the framework easier to extend (e.g., adding new browsers or new email pages) without modifying client code.

Decorator Pattern

Used in: ComputeEngineConfigurator and its decorators

Purpose: Extend behavior without modifying existing code (Open/Closed Principle).

  • Optional compute engine features (GPU, commitment) are implemented as decorators.
  • New configuration options can be added by creating new decorators rather than changing core logic.
  • Avoids large conditional blocks and feature-specific branching.

Facade Pattern

Used in: EmailFacade

Purpose: Provide a simplified interface to complex subsystems.

  • Encapsulates coordination between multiple email-related page objects.
  • Test code interacts with a single, high-level API instead of orchestrating multiple pages.
  • Reduces coupling and improves readability of test scenarios.

Context Pattern

Used in: TestContext

Purpose: Encapsulate environment and execution context.

  • Centralizes access to shared test state such as base URLs and WebDriver instances.
  • Keeps test classes focused purely on test logic rather than setup and configuration.
  • Improves consistency across tests and environments.

Singleton Pattern

Used in: TestSession

Purpose: Ensure a single shared instance for global session data.

  • Provides a single source of truth for session-level metadata (environment, execution time).
  • Prevents duplication and inconsistent state across tests.

Transformer Pattern (TestNG)

Used in: RetryTransformer

Purpose: Apply cross-cutting behavior dynamically.

  • Automatically attaches retry logic to tests without modifying individual test classes.
  • Standardizes retry behavior across the entire test suite.
  • Keeps retry concerns separate from test logic.

Dependency Inversion & Single Responsibility Principles

Applied across the framework

  • UI interaction logic extracted into UiActions, decoupling pages from low-level actions.
  • Page objects depend on abstractions rather than concrete implementations.
  • Each class has a clearly defined responsibility.

Utilities

BrowserUtil

  • Manage browser tabs and windows

ClipboardUtil

  • Read from the system clipboard
  • Clear the system clipboard

DriverManager / DriverFactory

  • Centralized WebDriver lifecycle and configuration management

Log

  • Log info, debug, and error messages using Log4j2

ScreenshotUtil

  • Capture screenshots for:
  • Test failures
  • Verification and reporting

Data Models

ComputeEngine

  • Represents a compute engine configuration

Email

  • Represents an email entity with:
  • Recipient
  • Subject
  • Body

Page Objects

GoogleCloudHomePage

  • Main landing page
  • Performs search actions

SearchResultsPage

  • Handles navigation through search results

PricingCalculatorPage

  • Accesses:
  • Pricing calculator forms
  • Promotional banners

ComputeEngineForm

  • Handles filling out the compute engine configuration form

Email Pages

  • EmailHomePage
  • EmailGeneratorPage
  • EmailInboxPage

Responsibilities:

  • Disposable email generation
  • Inbox access and interaction

Test Strategy

  • Framework: TestNG

Test Groups

  • smoke
  • regression

Data-Driven Testing

  • Uses ComputeEngineDataProvider
  • Supplies multiple compute engine configurations

Test Suites

tests.PricingCalculatorTest

  • Verifies accessibility of the pricing calculator

tests.EmailTest

  • Verifies:
  • Disposable email generation
  • Inbox accessibility

tests.GenerateEstimateAndShareTest

  • End-to-end flow:
  1. Generate a pricing estimate
  2. Share the estimate via email
  3. Verify price consistency between UI and email

About

Selenium + Java TestNG framework implementing the Page Object Model (POM) to automate E2E Google Cloud pricing workflows, following SOLID principles and various design patterns.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages