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.
To run the tests and use the automation framework, follow these steps:
Clone the repository:
bashCopy code
git clone https://github.com/RupamDas-ts/FlightReservationAutomation.git
Navigate to the project directory:
bashCopy code
cd FlightReservationAutomation
Set up your environment:
Ensure you have Java installed. You can download it from here.
Install necessary dependencies using Maven:
bashCopy code
mvn clean install
Create Cucumber.yaml
file with your own credentials the same structure as Cucumber.sample.yml
and keep that in
the TestConfigs
directory
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
To re-run failed tests:
mvn test -DENV_NAME=LambdaTest -DsuiteXmlFile=testng-rerun.xml -DPARALLEL=2
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
Cucumber.yaml
file to configure credentials to run tests on remote platforms or use local
as ENV_NAME
PARALLEL
value as per requirements like, -DPARALLEL=1
-DPARALLEL=2
for parallel execution of two tests.RUN_N_TIMES
environment variable to the desired number of iterations.testng.xml
for regular test execution.testng-rerun.xml
for re-running failed tests.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 <CONTAINER_NAME> .
Replace <CONTAINER_NAME>
with the desired name for your 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" <CONTAINER_NAME>
Replace <CUCUMBER_COMMAND> with your specific Cucumber command and <CONTAINER_NAME> with the name of your Docker container.
This will execute the specified Cucumber command within the Docker container
Contributions are welcome! If you'd like to contribute to this project, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or issues regarding the project, please feel free to contact me at [email protected].