Getting Started with Karate DSL
Getting Started with Karate DSL
Karate DSL is an open-source unified framework with capabilities such as API Automation, UI Automation, Performance Testing, and Desktop automation.
Karate DSL is an open-source Webservices Test Automation Framework. The framework’s tests are written in Cucumber BDD Syntax, which is language-neutral. The step definitions are already included in the tool.
Karate DSL Features
- Open-source. Code is on GitHub repository with good number of stars.
- Language neutral Cucumber style BDD syntax.
- Apache Maven Integration to build automation project on the fly.
- JSON and XML content type support.
- IDE Integration : IntelliJ , Eclipse IDE support
- Codeless Automation. Tests can be developed even by Team members with minimum programming knowledge.
- Data driven Testing
- Parallel Execution of Tests to save time.
- In-built Test Reports
- Junit 4/ JUnit 5 Support
Maven Dependencies
To add Karate framework the project add the Karate dependencies to the Maven pom.xml build file. Replace the version with the latest version to get new features.
Karate Core
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-core</artifactId>
<version>0.9.4</version>
</dependency>
Karate JUnit 5 Integration
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>0.9.4</version>
</dependency>
For additional reports, we can also use Maven Surefire
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
Project Structure
Normally, non-java files like feature files are placed under /src/test/resources directory. However, Karate team recommends to place the feature files along side with java files in the project. To make this change add the following build configuration to pom.xml file.
Feature files can be created under /src/test/java directory in the project.
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
Create Project
To create an automation project with Karate Framework using the Apache Maven build tool, follow the below link:
https://www.testingdocs.com/create-karate-automation-project/