E-commerce Test Automation Framework built with Selenium WebDriver, C#, and NUnit using Page Object Model (POM) design pattern.
- About The Project
- Built With
- Project Architecture
- Getting Started
- Test Cases
- Running Tests
- Test Reports
- Project Highlights
- Contact
This is a robust test automation framework designed to demonstrate best practices in test automation for e-commerce applications. The framework tests the complete user registration flow on AutomationExercise.com including user signup, account creation, and account deletion.
Key Features:
- โ Page Object Model (POM) design pattern
- โ Reusable business flow components
- โ Data-driven testing with random test data generation
- โ Detailed HTML test reports with screenshots
- โ Cross-browser testing support (Chrome, Firefox, Edge)
- โ Parallel test execution capability
- โ Screenshot capture on test failures
- โ CI/CD ready with GitHub Actions
Core Technologies:
- Language: C# (.NET 6.0)
- Automation Tool: Selenium WebDriver 4.15
- Testing Framework: NUnit 3.14
- Build Tool: MSBuild / Visual Studio 2022
- Driver Management: WebDriverManager 2.17
- Reporting: ExtentReports 5.0
AutomationExercise/
โ
โโโ ๐ Pages/ # Page Object classes
โ โโโ BasePage.cs # Common page methods
โ โโโ HomePage.cs # Home page interactions
โ โโโ SignupLoginPage.cs # Signup/Login page
โ โโโ SignupPage.cs # Registration form page
โ โโโ AccountCreatedPage.cs # Account success page
โ โโโ AccountDeletedPage.cs # Account deletion page
โ
โโโ ๐ Flows/ # Business logic flows
โ โโโ RegistrationFlow.cs # Complete registration workflow
โ โโโ LoginFlow.cs # User login workflow
โ
โโโ ๐ Tests/ # Test cases
โ โโโ BaseTest.cs # Test setup/teardown
โ โโโ RegistrationTests.cs # Registration test scenarios
โ โโโ AllTests.cs # Main test suite
โ
โโโ ๐ Utils/ # Utility classes
โ โโโ DriverFactory.cs # WebDriver initialization
โ โโโ ConfigReader.cs # Configuration management
โ โโโ TestDataGenerator.cs # Random test data
โ โโโ ScreenshotHelper.cs # Screenshot utilities
โ
โโโ ๐ TestData/ # Test data models
โ โโโ UserData.cs # User data structure
โ
โโโ ๐ Reports/ # Generated test reports
โโโ ๐ Screenshots/ # Failure screenshots
โโโ app.config # Application configuration
โโโ README.md # Project documentation
Design Pattern: Page Object Model (POM)
- Separates test logic from UI interactions
- Improves code reusability and maintainability
- Makes tests more readable and easier to maintain
- Visual Studio 2022 or later
- .NET 6.0 SDK or later
- Chrome/Firefox/Edge browser installed
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/Selenium-CSharp-NUnit-Automation-Framework.git cd Selenium-CSharp-NUnit-Automation-Framework
-
Open in Visual Studio
- Open
AutomationExercise.sln
in Visual Studio
- Open
-
Restore NuGet Packages
dotnet restore
Or in Visual Studio:
Tools > NuGet Package Manager > Restore NuGet Packages
-
Build the solution
dotnet build
Edit app.config
to customize settings:
<configuration>
<appSettings>
<add key="BaseUrl" value="http://automationexercise.com" />
<add key="Browser" value="Chrome" />
<add key="ImplicitWait" value="10" />
<add key="ExplicitWait" value="20" />
<add key="TakeScreenshotOnFailure" value="true" />
</appSettings>
</configuration>
Scenario: Complete user registration flow
Step | Action | Expected Result |
---|---|---|
1 | Launch browser | Browser opens successfully |
2 | Navigate to URL | Website loads |
3 | Verify home page | Home page is visible |
4 | Click 'Signup / Login' | Navigation successful |
5 | Verify 'New User Signup!' | Text is visible |
6 | Enter name and email | Fields populated |
7 | Click 'Signup' button | Form submits |
8 | Verify 'ENTER ACCOUNT INFORMATION' | Page visible |
9 | Fill details (Title, Name, Email, Password, DOB) | All fields filled |
10 | Select 'Sign up for newsletter!' | Checkbox selected |
11 | Select 'Receive special offers!' | Checkbox selected |
12 | Fill address details | All fields filled |
13 | Click 'Create Account' | Account created |
14 | Verify 'ACCOUNT CREATED!' | Success message shown |
15 | Click 'Continue' | Navigation to logged in state |
16 | Verify 'Logged in as username' | User is logged in |
17 | Click 'Delete Account' | Account deletion initiated |
18 | Verify 'ACCOUNT DELETED!' | Success message shown |
dotnet test
dotnet test --filter "FullyQualifiedName~RegistrationTests.TestCase1_RegisterUser"
# Run smoke tests
dotnet test --filter TestCategory=Smoke
# Run regression tests
dotnet test --filter TestCategory=Regression
Modify app.config
or pass as parameter:
// In code
DriverFactory.InitDriver("Firefox");
- Open Test Explorer:
Test > Test Explorer
- Click
Run All
or right-click specific tests - View results in real-time
After test execution, find reports in:
Reports/TestReport_YYYY-MM-DD_HH-MM-SS.html
Report includes:
- Test execution summary (Pass/Fail/Skip)
- Detailed step-by-step logs
- Screenshots for failed tests
- Execution time for each test
- Browser and environment details
Failed test screenshots are saved in:
Screenshots/TestName_YYYY-MM-DD_HH-MM-SS.png
-
Industry-Standard Design Pattern
- Implements Page Object Model for maximum maintainability
- Separates business logic from test logic
-
Reusable Components
- Flow classes enable complex scenario testing
- DRY (Don't Repeat Yourself) principle throughout
-
Robust & Reliable
- Explicit waits prevent flaky tests
- Screenshot capture for debugging
- Comprehensive error handling
-
Scalable Architecture
- Easy to add new test cases
- Supports multiple browsers
- Ready for parallel execution
-
Professional Reporting
- Detailed HTML reports with ExtentReports
- Visual evidence with screenshots
- Easy to share with stakeholders
-
CI/CD Ready
- Can integrate with GitHub Actions
- Azure DevOps compatible
- Jenkins pipeline ready
- Integrate with GitHub Actions for CI/CD
- Add API testing layer
- Implement Docker containerization
- Add database validation
- Cross-browser parallel execution
- Integrate with Allure reporting
- Add performance testing metrics
- Implement BDD with SpecFlow
Your Name
- LinkedIn: Aaquib Ahmad
- Email: aaquib.ahmadus@example.com
- Portfolio: aaquibahmad
Project Link: https://github.com/YOUR_USERNAME/Selenium-CSharp-NUnit-Automation-Framework
This project is licensed under the MIT License - see the LICENSE file for details.
- Test scenarios from AutomationExercise.com
- Selenium WebDriver documentation
- NUnit framework documentation
- C# and .NET community
Made with โค๏ธ by Aaquib Ahmad