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.
AIKY2-FK1VU-VIJ7N-OICUQ.mp4
- 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.
- 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.
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 asCucumber.sample.yml
and keep that in theTestConfigs
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
- Modify the
Cucumber.yaml
file to configure credentials to run tests on remote platforms or uselocal
asENV_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.
- Ensure Docker is installed on your system. You can download it from here.
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 dasrupam740@example.com.