An open API service indexing awesome lists of open source software.

https://github.com/md-sikder/selenium-pytest-github-ci-cd

This repository contains a web automation framework using Selenium, Python, and Pytest, integrated with GitHub Actions for Continuous Integration (CI) and Continuous Deployment (CD), enabling automated tests to run with codebase changes.
https://github.com/md-sikder/selenium-pytest-github-ci-cd

html-report pytest selenium-python webautomationtesting

Last synced: 10 months ago
JSON representation

This repository contains a web automation framework using Selenium, Python, and Pytest, integrated with GitHub Actions for Continuous Integration (CI) and Continuous Deployment (CD), enabling automated tests to run with codebase changes.

Awesome Lists containing this project

README

          

# Web Automation Framework with Selenium, Python, and GitHub Actions CI/CD

This project is a **web automation framework** using **Selenium** and **Python**, integrated with **GitHub Actions** for **Continuous Integration and Continuous Deployment (CI/CD)**. The framework is designed for automating web application testing, with the tests executed automatically on each code push to the repository.

## Features

- **Web Automation:** Use Selenium and Python to automate web application testing.
- **CI/CD Integration:** Automatically run tests with GitHub Actions on each push to the repository.
- **Test Reporting:** Generate test reports in HTML format, making it easy to view test results.
- **Easy Setup:** Minimal configuration required to get started.

## Getting Started

Follow the steps below to set up and run the automation framework locally and on GitHub.

### Prerequisites

- **Python 3.8+** installed on your local machine.
- **Google Chrome** and **ChromeDriver** (or any browser and corresponding driver of your choice).
- **GitHub Account** for pushing code and utilizing GitHub Actions CI/CD.

### Installation

1. Clone this repository to your local machine:

```bash
git clone https://github.com/your-username/web_automation.git
cd web_automation
```

2. Install the required dependencies:

```bash
pip install -r requirements.txt
```

### Running Tests Locally

You can run the tests locally by using the following command:

```bash
pytest --maxfail=1 --disable-warnings -q --html=report.html
```

This will execute the tests and generate a `report.html` file that contains the test results.

### GitHub Actions CI/CD

This project is configured with **GitHub Actions** to automatically run the tests on each push to the `main` branch. The CI/CD workflow is defined in `.github/workflows/ci-cd.yml`.

When you push to the `main` branch, GitHub Actions will:

1. Set up the Python environment.
2. Install dependencies listed in `requirements.txt`.
3. Run the tests using `pytest`.
4. Upload the test results as an HTML report.

Check the **Actions tab** in your GitHub repository to view the workflow results.

### Test Results

Test results will be available in the **Actions tab** of the repository under the latest run. You can download the `pytest-report` artifact which contains the `report.html` for detailed test results.

## Contributing

We welcome contributions to this project! Here’s how you can help:

### How to Contribute

1. **Fork this repository** to your GitHub account.
2. **Clone your fork** to your local machine:

```bash
git clone https://github.com/your-username/web_automation.git
```

3. Create a **new branch** for your changes:

```bash
git checkout -b feature-branch
```

4. Make your changes and **commit** them:

```bash
git commit -m "Describe your changes"
```

5. **Push** your changes to your fork:

```bash
git push origin feature-branch
```

6. Open a **pull request** from your feature branch to the `main` branch of the original repository.

### Code Style

Please adhere to the following guidelines when contributing:

- Follow **PEP 8** standards for Python code.
- Write clear and concise commit messages.
- Include comments and documentation where necessary.

## License

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Selenium and Python for providing the tools to automate web testing.
- GitHub Actions for enabling automated CI/CD workflows.
- Thanks to all contributors for helping improve this project.

```

### Explanation:
- **Introduction:** The first section explains the purpose of the project and lists key features.
- **Getting Started:** This section gives the setup instructions, such as prerequisites, cloning the repo, and installing dependencies.
- **Running Tests Locally:** Instructions for running the tests locally.
- **CI/CD Integration:** A section explaining how the GitHub Actions workflow is set up and how it automates testing on every push.
- **Contributing:** Provides a guide on how to contribute to the project, including forking, creating branches, committing changes, and submitting pull requests.
- **License:** The project uses the MIT License, so contributors can freely use and distribute it. A link to the full license text is included (assuming it’s in a separate `LICENSE` file).