Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/rupamdas-ts/flightreservationautomation

Web Automation Framework using Selenium, Java, REST Assured
https://github.com/rupamdas-ts/flightreservationautomation

cucumber docker extentreports groovy-script java jenkins restassured selenium testng

Last synced: 1 day ago
JSON representation

Web Automation Framework using Selenium, Java, REST Assured

Awesome Lists containing this project

README

        

Flight Booking Automation
=========================

Overview
--------

This project automates the flight booking process on a travel website using Selenium, Java, Rest Assured, and Cucumber
framework. It allows users to specify various test combinations such as browser name, version, and platform to run the
tests. The automation includes creating a new account using a temporary email address generated via the One Sec Mail
API, fetching OTP for account creation, and booking flights from a specified origin to a destination on a given date.

## Demo Video

https://github.com/RupamDas-ts/FlightReservationAutomation/assets/123362738/4b8e7ae3-9118-4f44-a217-79c822c3a6f2

Features
--------

* Automated flight booking process on a travel website.
* User-defined test combinations for browser name, version, and platform.
* Creating a new account using a temporary email address.
* Fetching OTP for account creation.
* Booking flights from a specified origin to a destination on a given date.

Technologies Used
-----------------

* Selenium WebDriver: For interacting with the web browser.
* Java: Programming language for test automation.
* Rest Assured: For interacting with the One Sec Mail API.
* Cucumber: BDD framework for test scenario organization and execution.

Getting Started
---------------

To run the tests and use the automation framework, follow these steps:

1. Clone the repository:

bashCopy code

`git clone https://github.com/RupamDas-ts/FlightReservationAutomation.git`

2. Navigate to the project directory:

bashCopy code

`cd FlightReservationAutomation`

3. Set up your environment:
* Ensure you have Java installed. You can download it
from [here](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html).
* Install necessary dependencies using Maven:

bashCopy code

`mvn clean install`

4. Create `Cucumber.yaml` file with your own credentials the same structure as `Cucumber.sample.yml` and keep that in
the `TestConfigs` directory

5. Run the tests:

bashCopy code for Linux or Mac

```CUCUMBER_FILTER_TAGS="@flightBooking" mvn test -DENV_NAME=LambdaTest -DsuiteXmlFile=testng.xml -DPARALLEL=2```

For Windows

```set CUCUMBER_FILTER_TAGS="@flightBooking"```

```mvn test -DENV_NAME="LambdaTest" -DsuiteXmlFile="testng.xml" -DPARALLEL=2```

6. To re-run failed tests:

```mvn test -DENV_NAME=LambdaTest -DsuiteXmlFile=testng-rerun.xml -DPARALLEL=2```
7. To run the same tests multiple times, set the `RUN_N_TIMES` environment variable:

```CUCUMBER_FILTER_TAGS="@flightBooking" mvn test -DENV_NAME=LambdaTest -DsuiteXmlFile=testng.xml -DPARALLEL=2 -DRUN_N_TIMES=3```

Configuration
-------------

* Modify the `Cucumber.yaml` file to configure credentials to run tests on remote platforms or use `local` as `ENV_NAME`
to run tests on your local.
* Tests can be run parallelly or serially by providing correct `PARALLEL` value as per requirements like, `-DPARALLEL=1`
for serial execution `-DPARALLEL=2` for parallel execution of two tests.
* To run tests multiple times, set the `RUN_N_TIMES` environment variable to the desired number of iterations.
* Use `testng.xml` for regular test execution.
* Use `testng-rerun.xml` for re-running failed tests.

Running the Project as a Docker Container
-------------

### Prerequisites
- Ensure Docker is installed on your system. You can download it from [here](https://www.docker.com/products/docker-desktop).

### Building the Docker Container
The Docker file is present in the project, which uses a parent image with JDK 22. You can build the Docker container from the given Docker file using the following command:

```sh docker build -t .```

Replace `` with the desired name for your Docker container.

### Running the Docker Container
When running the container, you need to pass an environment variable named `CUCUMBER_RUN_SCRIPT`, which accepts the Cucumber command you want to run. For example:

```docker run --rm -e CUCUMBER_RUN_SCRIPT="CUCUMBER_FILTER_TAGS='@flightBooking' mvn test -DENV_NAME=LambdaTest -DsuiteXmlFile=testng.xml -DPARALLEL=2" ```

Replace with your specific Cucumber command and with the name of your Docker container.

This will execute the specified Cucumber command within the Docker container

Contributing
------------

Contributions are welcome! If you'd like to contribute to this project, feel free to fork the repository and submit a
pull request.

License
-------

This project is licensed under the MIT License. See the LICENSE file for details.

Contact
-------

For any inquiries or issues regarding the project, please feel free to contact me at [email protected].