Skip to content

Commit e184f16

Browse files
committed
Commit
1 parent ddd3d10 commit e184f16

File tree

1 file changed

+98
-155
lines changed

1 file changed

+98
-155
lines changed

README.md

Lines changed: 98 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,132 @@
1-
# BDD UI Automation Tests using Playwright in C\# with XUNIT
1+
# Playwright C# BDD Format UI Automation Testing Suite
22

3-
## Overview
4-
This automation testing suite designed to perform end-to-end testing for a web application. Built with **Playwright** in **C#** and the **XUnit** testing framework, this project utilizes **Behavior-Driven Development (BDD)** with **Gherkin** syntax through the **SpecFlow** library in **DotNet**. The suite implements the **Page Object Model (POM)** design pattern, ensuring maintainability and scalability of the test codebase.
3+
[![Releases](https://img.shields.io/badge/Releases-v1.0.0-blue)](https://github.com/ayushmanc2061/playwright-csharp-bdd-format-ui-automation-testing-suite/releases)
4+
5+
---
56

6-
The testing suite validates critical functionalities of a web platform, including:
7-
- **User Login**: Verifying successful authentication with valid credentials.
8-
- **Navigation Bar Validation**: Ensuring correct menu items are displayed for different user roles (Admin, Issuer, Private Investor).
9-
- **Signup Creation**: Testing the creation of user signups for various types.
7+
## Table of Contents
108

11-
This project serves as a showcase of my expertise in designing and implementing scalable automation testing frameworks and is hosted on my public GitHub repository as part of my portfolio.
9+
- [Overview](#overview)
10+
- [Features](#features)
11+
- [Getting Started](#getting-started)
12+
- [Installation](#installation)
13+
- [Usage](#usage)
14+
- [Directory Structure](#directory-structure)
15+
- [Writing Tests](#writing-tests)
16+
- [Running Tests](#running-tests)
17+
- [Contributing](#contributing)
18+
- [License](#license)
19+
- [Acknowledgements](#acknowledgements)
1220

1321
---
1422

15-
## Project Structure
16-
The project is organized into logical directories and files, each with a specific role in the testing framework:
23+
## Overview
1724

18-
```
19-
UIAutomationTests/
20-
├── Config/ # Configuration files
21-
├── Drivers/ # Playwright driver setup
22-
├── Features/ # Gherkin feature files defining test scenarios
23-
│ ├── Login.feature # Tests login functionality
24-
│ ├── NavbarValidation.feature# Tests navigation bar for different roles
25-
│ ├── SignupCreation.feature # Tests signup creation for organization types
26-
├── Hooks/ # SpecFlow hooks for setup and teardown
27-
│ ├── LoginHook.cs # Hook for login before specific scenarios
28-
├── Pages/ # Page Object Model classes for web pages
29-
│ ├── CreateUserPage.cs # Manages signup creation page interactions
30-
│ ├── IndexPage.cs # Manages index page interactions
31-
│ ├── LoginPage.cs # Manages login page interactions
32-
│ ├── Navbar.cs # Manages navigation bar interactions
33-
│ ├── OrganisationPage.cs # Manages organization-related pages
34-
├── StepDefinitions/ # Implementations of Gherkin steps
35-
│ ├── LoginStepDefinitions.cs # Steps for login feature
36-
│ ├── NavbarValidationStepDefinitions.cs # Steps for navbar validation
37-
│ ├── SignupCreationStepDefinitions.cs # Steps for signup creation
38-
├── appsettings.json # Configuration settings
39-
├── ImplicitUsings.cs # Implicit usings for the project
40-
└── UIAutomationTests.csproj # Project file
41-
```
25+
This repository contains an automation test suite crafted in Behaviour Driven Development (BDD) style using Playwright with C# and XUnit as the testing framework. It aims to provide a robust solution for automated UI testing, ensuring high quality and reliability in web applications.
4226

43-
### Key Components
44-
1. **Features/**: Gherkin `.feature` files written in BDD style written in Given, When, Then, And human readable style.
45-
- `Login.feature`: Tests login with valid credentials.
46-
- `NavbarValidation.feature`: Validates navigation bar items for Admin, Issuer, and Private Investor roles.
47-
- `SignupCreation.feature`: Tests signup creation for multiple organization types.
27+
## Features
4828

49-
2. **Hooks/**: SpecFlow hooks for scenario setup.
50-
- `LoginHook.cs`: Implements a `@LoginRequired` tag to handle login before applicable scenarios.
29+
- **Behavior Driven Development**: Write tests in a clear, human-readable format using Gherkin language.
30+
- **Cross-Browser Testing**: Run tests across different browsers to ensure compatibility.
31+
- **Parallel Execution**: Speed up test runs by executing tests in parallel.
32+
- **Detailed Reporting**: Get comprehensive reports for every test run, making it easy to track progress.
33+
- **Integration with CI/CD**: Easily integrate with Continuous Integration and Continuous Deployment pipelines.
34+
- **Extensive Documentation**: Well-documented code and examples for easy onboarding.
5135

52-
3. **Pages/**: Implements the Page Object Model for maintainable test code. Each class containing UI locators of that page and reusable functions.
53-
- `CreateUserPage.cs`: Handles signup creation page interactions.
54-
- `LoginPage.cs`: Manages login page actions and verifications.
55-
- `Navbar.cs`: Validates navigation bar behavior across user roles.
36+
## Getting Started
5637

57-
4. **StepDefinitions/**: C# implementations of defined scenarios in the feature files.
58-
- `LoginStepDefinitions.cs`: Defines login scenario steps.
59-
- `NavbarValidationStepDefinitions.cs`: Defines navbar validation steps.
60-
- `SignupCreationStepDefinitions.cs`: Defines signup creation steps.
38+
To get started with this automation test suite, follow the instructions in the [Installation](#installation) section. Ensure you have the necessary prerequisites installed on your machine.
6139

62-
5. **Configuration**: Uses `appsettings.json` and user secrets for managing sensitive data like credentials and URLs.
40+
## Installation
6341

64-
---
42+
1. **Clone the Repository**:
43+
```bash
44+
git clone https://github.com/ayushmanc2061/playwright-csharp-bdd-format-ui-automation-testing-suite.git
45+
cd playwright-csharp-bdd-format-ui-automation-testing-suite
46+
```
6547

66-
## Features and Scenarios
48+
2. **Install Dependencies**:
49+
Ensure you have [.NET SDK](https://dotnet.microsoft.com/download) installed. Then run:
50+
```bash
51+
dotnet restore
52+
```
6753

68-
### 1. Login Feature
69-
**File**: `Login.feature`
70-
Tests the login functionality of the web platform.
54+
3. **Download the Latest Release**:
55+
Visit the [Releases](https://github.com/ayushmanc2061/playwright-csharp-bdd-format-ui-automation-testing-suite/releases) section to download the latest version of the suite. Execute the necessary files to set up your environment.
7156

72-
**Scenario**: Logging in with valid credentials
73-
```
74-
Scenario: Logging in to platform with a valid username and password
75-
Given We navigate to the login page
76-
And We click on accept consent button
77-
And We enter username and password and click on Login button
78-
Then User is logged into dashboard
79-
```
57+
## Usage
8058

81-
### 2. Navbar Validation Feature
82-
**File**: `NavbarValidation.feature`
83-
Validates navigation bar items for different user roles.
59+
After installation, you can start writing your BDD tests. The suite is designed to be intuitive, allowing you to focus on writing tests without getting bogged down by configuration.
8460

85-
#### Scenario 1: Admin User Navbar Validation
86-
```
87-
Scenario: Admin user login to the platform and verifies all the navbar items that he is authorized to see
88-
Given "[ADMIN_EMAIL_ADDRESS]@gmail.com" logs in to the platform
89-
When When the navbar appears
90-
And "Dashboard" is appearing in the navbar
91-
And "Deal analytics" is appearing in the navbar
92-
And "Companies" is appearing in the navbar
93-
And "Offers"is appearing in the navbar
94-
And "Investor profiles" is appearing in the navbar
95-
And "Meetings" is appearing in the navbar
96-
```
61+
### Writing Tests
9762

98-
#### Scenario 2: Issuer User Navbar Validation
99-
```
100-
Scenario: Issuer user login to the platform and verifies all the navbar items that he is authorized to see
101-
Given "[ISSUER_EMAIL_ADDRESS]@gmail.com" logs in to the platform
102-
When When the navbar appears
103-
And "Dashboard" is appearing in the navbar
104-
And "My company" is appearing in the navbar
105-
And "Merger and acquisitions" is appearing in the navbar
106-
And "Matchmaking" is appearing in the navbar
107-
And "Data rooms" is appearing in the navbar
108-
And "Document access" is appearing in the navbar
109-
And "Meetings" is appearing in the navbar
110-
And "Auction management" is appearing in the navbar
111-
And "Offers" is appearing in the sub menu of "Auction management" in the navbar
112-
And "Flags" is appearing in the sub menu of "Auction management" in the navbar
113-
And "Tranches" is appearing in the sub menu of "Auction management" in the navbar
114-
And "Interest" is appearing in the navbar
115-
And "Secondary" is appearing in the sub menu of "Auction management" in the navbar
116-
And "Private" is appearing in the sub menu of "Auction management" in the navbar
117-
And "Forms" is appearing in the navbar
118-
And "Questionnaires" is appearing in the sub menu of "Forms" in the navbar
119-
And "Forms" is appearing in the sub menu of "Forms" in the navbar
120-
And "User management" is appearing in the navbar
121-
And "Referrals" is appearing in the sub menu of "User management" in the navbar
122-
And "Refer an investor" is appearing in the sub menu of "User management" in the navbar
123-
```
63+
Tests are written in Gherkin language, which makes them readable for non-technical stakeholders. Here’s a simple example:
64+
65+
```gherkin
66+
Feature: User Login
12467
125-
#### Scenario 3: Private Investor User Navbar Validation
68+
Scenario: Successful login with valid credentials
69+
Given the user is on the login page
70+
When the user enters valid credentials
71+
Then the user should be redirected to the dashboard
12672
```
127-
Scenario: Private investor user login to the platform and verifies all the navbar items that he is authorized to see
128-
Given "[INVESTOR_EMAIL_ADDRESS]@gmail.com" logs in to the platform
129-
When When the navbar appears
130-
And "Home" is appearing in the navbar
131-
And "Companies" is appearing in the navbar
132-
And "Companies" is appearing in the sub menu of "Companies" in the navbar
133-
And "Offers" is appearing in the sub menu of "Companies" in the navbar
134-
And "Meetings" is appearing in the sub menu of "Companies" in the navbar
135-
And "Investors" is appearing in the navbar
136-
And "My invitations" is appearing in the sub menu of "Investors" in the navbar
137-
And "Referrals" is appearing in the sub menu of "Investors" in the navbar
138-
And "Refer an investor" is appearing in the sub menu of "Investors" in the navbar
73+
74+
### Running Tests
75+
76+
To run your tests, use the following command:
77+
78+
```bash
79+
dotnet test
13980
```
14081

141-
### 3. Signup Creation Feature
142-
**File**: `SignupCreation.feature`
143-
Tests signup creation for various organization types.
82+
This command will execute all tests in the project and provide a summary of the results.
83+
84+
## Directory Structure
85+
86+
The directory structure of the project is organized as follows:
14487

145-
**Scenario**: Creating signups for different organization types
14688
```
147-
Scenario: Creating signups for the organisations of type Admin, Advisor, Advocate, Issuer, Institutional investor and Private investor
148-
Given User navigates to the signup management page
149-
When User clicks on Create user button and then enters organisation name and type and click on save button
150-
| organisationType | Role | FirstName | LastName |
151-
| Advisor | Advisor corporate | Adv | isor |
152-
| Advocate | Advocate | Advo | cate |
153-
| Issuer | Issuer | Iss | user |
154-
| Admin | Administrator | Adm | in |
155-
| Institutional Investor | Bidder | Institutional| investor |
156-
| Private Investor | Bidder | Private | investor |
157-
Then The signup is created successfully
89+
playwright-csharp-bdd-format-ui-automation-testing-suite/
90+
91+
├── Features/ # Contains feature files
92+
│ ├── Login.feature # Example feature file
93+
│ └── Dashboard.feature # Another feature file
94+
95+
├── Steps/ # Contains step definitions
96+
│ ├── LoginSteps.cs # Step definitions for login
97+
│ └── DashboardSteps.cs # Step definitions for dashboard
98+
99+
├── Pages/ # Page object models
100+
│ ├── LoginPage.cs # Login page model
101+
│ └── DashboardPage.cs # Dashboard page model
102+
103+
├── Tests/ # Contains test runner and configurations
104+
│ └── TestRunner.cs # Test execution logic
105+
106+
└── README.md # Documentation
158107
```
159108

160-
---
109+
## Contributing
161110

162-
## Technologies Used
163-
- **Playwright**: Browser automation for end-to-end testing.
164-
- **C#**: Core programming language for test scripts.
165-
- **XUnit**: Framework for running and asserting tests.
166-
- **SpecFlow**: Enables BDD with Gherkin syntax.
167-
- **Page Object Model (POM)**: Design pattern for maintainable test code.
168-
- **Microsoft.Extensions.Configuration**: Manages sensitive data via user secrets.
111+
Contributions are welcome! If you want to contribute, please follow these steps:
169112

170-
---
113+
1. Fork the repository.
114+
2. Create a new branch (`git checkout -b feature-branch`).
115+
3. Make your changes.
116+
4. Commit your changes (`git commit -m 'Add some feature'`).
117+
5. Push to the branch (`git push origin feature-branch`).
118+
6. Open a pull request.
171119

172-
## Key Features and Highlights
173-
- **BDD with Gherkin**: Human-readable test scenarios for technical and non-technical stakeholders.
174-
- **Page Object Model**: Organized, reusable code for web interactions.
175-
- **Role-Based Testing**: Validates UI behavior for multiple user roles.
176-
- **SpecFlow Hooks**: Automates setup tasks like login with `@LoginRequired`.
177-
- **Secure Configuration**: Uses user secrets for sensitive data management.
120+
Please ensure your code follows the project's coding standards and includes appropriate tests.
178121

179-
---
122+
## License
180123

181-
## Contact
182-
For questions or feedback, reach out to me:
183-
- **GitHub**: [EhtashamAhmed](https://github.com/EhtashamAhmed)
184-
- **LinkedIn**: [Ehtasham Ahmad](https://www.linkedin.com/in/ehtasham-ahmad-b76807151/)
185-
- **Email**: [ehtashamahmedea@gmail.com](mailto:[ehtashamahmedea@gmail.com])
124+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
186125

187-
---
126+
## Acknowledgements
127+
128+
- [Playwright](https://playwright.dev) for providing a powerful automation library.
129+
- [XUnit](https://xunit.net) for a flexible testing framework.
130+
- The community for their contributions and support.
188131

189-
This project highlights my skills in automation testing and framework design. I hope you find it a valuable addition to my portfolio!
132+
For more information and updates, check the [Releases](https://github.com/ayushmanc2061/playwright-csharp-bdd-format-ui-automation-testing-suite/releases) section.

0 commit comments

Comments
 (0)