GET STARTED
Quickstart
Maven Archetype
The Karate Maven archetype creates a recommended project structure with a complete pom.xml configuration, sample tests, and JUnit 5 runners, enabling you to start running Karate tests fast.
You can replace the values of com.mycompany
and myproject
as per your needs.
- macOS
- Windows
- Linux
mvn archetype:generate \
-DarchetypeGroupId=io.karatelabs \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=1.5.1 \
-DgroupId=com.mycompany \
-DartifactId=myproject
mvn archetype:generate `
"-DarchetypeGroupId=io.karatelabs" `
"-DarchetypeArtifactId=karate-archetype" `
"-DarchetypeVersion=1.5.1" `
"-DgroupId=com.mycompany" `
"-DartifactId=myproject"
When running the command in Windows (PowerShell) you must use quotes around each property value to prevent parsing errors.
mvn archetype:generate \
-DarchetypeGroupId=io.karatelabs \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=1.5.1 \
-DgroupId=com.mycompany \
-DartifactId=myproject
This will create a folder called myproject
(or whatever you set the name to).
Project Structure
The archetype generates a complete project structure with everything you need. Karate test scripts use the .feature
file extension (following Cucumber standards) and are organized alongside your Java test classes:
.
├── pom.xml # Maven configuration with Karate dependencies
├── src
│ └── test
│ └── java
│ ├── examples
│ │ ├── ExamplesTest.java # Main test suite runner
│ │ └── users
│ │ ├── users.feature # Karate test script
│ │ └── UsersRunner.java # Individual feature runner
│ ├── karate-config.js # Global test configuration
│ └── logback-test.xml # Logging settings
└── target # Build outputs (created after running tests)
├── generated-test-sources # Auto-generated test source files
├── karate-reports # HTML test reports and assets
├── karate.log # Test execution log
├── maven-status # Maven build metadata
├── surefire-reports # JUnit XML reports
└── test-classes # Compiled test classes and copied resources
Key benefits of this structure:
.feature
files live next to.java
files (not in separate folders)- Easy to find and manage related test files together
- No switching between different source directories
- Sample test included to get you started quickly
IDE Support
Want to skip the manual setup and dependency management? Use your favorite IDE with Karate extensions for syntax highlighting, auto-completion, and integrated test execution:
These IDE extensions provide intelligent code completion, syntax validation, and the ability to run tests directly from your editor - no command line setup required.
Next Steps
With your project created, proceed to write your first test to start building your test suite.