This project is a test automation framework using [Karate] and Gradle to test the signup and login functionalities of the PetStore API.
Before you begin, ensure you have met the following requirements:
- Java Development Kit (JDK): Version 11 or higher. You can download it from OpenJDK or use a package manager like Homebrew.
- Gradle: Version 6.0 or higher. You can download it from the Gradle website or use a package manager like Homebrew.
-
Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install JDK 11:
brew install openjdk@11
-
Set JDK 11 as the default:
Add the following lines to your
~/.zshrc
or~/.bash_profile
:export JAVA_HOME=/opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk/Contents/Home export PATH=$JAVA_HOME/bin:$PATH
Then, reload your shell configuration:
source ~/.zshrc # or source ~/.bash_profile
-
Install Gradle:
brew install gradle
- Install JDK 11:
- Download the JDK installer from the OpenJDK website.
- Run the installer and follow the instructions.
- Set JDK 11 as the default:
- Open Environment Variables:
- Press Win + X and select System.
- Click on Advanced system settings.
- Click on Environment Variables.
- Add a new System variable:
- Variable name: JAVA_HOME
- Variable value: C:\Program Files\OpenJDK\jdk-11 (adjust based on your installation path)
- Edit the Path variable and add: %JAVA_HOME%\bin
- Install Gradle:
- Download the Gradle binary from the Gradle website.
- Extract the downloaded ZIP file to C:\Gradle.
- Add C:\Gradle\bin to your Path environment variable.
Verify that Java and Gradle are installed correctly:
java -version
gradle -version
- Clone the repository:
git clone https://github.com/andresgranizo/petstore-karate
cd petstore-karate
- Build the project:
gradle clean build
- Run the test:
gradle test
After running the tests, you can view the test results in the generated HTML report:
- Navigate to the report directory:
cd target/cucumber-html-reports
- Open the overview-features.html file in a web browser to see the detailed test results.
open overview-features.html # macOS
xdg-open overview-features.html # Linux
start overview-features.html # Windows