-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Get Started: JetBrains IntelliJ
An 8 minute video walk-through of these steps (installing IntelliJ, Git, the official Karate plugin, a JDK, and running your first API test) can be viewed here: Karate Kick Start - From Zero to First API Test in IntelliJ IDEA
The official Karate plugins work for both IntelliJ IDEA and the Community Edition. They can be downloaded from here: https://www.jetbrains.com/idea/download
The Karate official plugin can be found on the JetBrains Market place here: Karate. It will be easier to install from within the IDE, read on below.
From within the IDE, go to the Settings
dialog (typically accessible via File -> Settings -> Plugins
) and select Plugins
on the left. Type karate
into the search field (for the Marketplace
) as shown below.
Click on the Install
button. After the install you may be asked to restart IntelliJ.
When you open IntelliJ you should see a dialog where you can create a New Project
like this (when Projects
is selected on the left).
If you are new to Karate, you can use the Karate Maven archetype to create a simple starter project.
After you click New Project
you can choose Maven Archetype
as the "Generator" on the left.
For "Catalog" choose Maven Central
. Then type com.intuit.karate:karate-archetype
into the Archetype
field.
You should see something like this below. Here we are using Karate version 1.4.0 - but you can use the latest version as per the documentation.
Now click the Create
button and once done, you should have a valid Karate Maven / Java project ready. Here below, we have opened the sample users.feature
.
- If you have Maven installed, you can follow these instructions and then open the project in IntelliJ.
- If you have Git installed, you can clone this karate-template project or the sample karate-test project.
- Or you can choose the
Get From VCS
option after you open IntelliJ and type in the Git URL as shown below. Also refer to the Kick Start YouTube video that shows this step for the IntelliJ Community Edition. IntelliJ will take care of installing Git, which can be very convenient.
Click on the >>
icon in the code-editor (on the same line where Feature:
appears) and you will see an option to Run
the file.
After running a test, you will see the test results window in your IDE. If you scroll all the way down on the console (button highlighted in red), you will see a link to open the HTML report.
You can now refer to the documentation and examples for more complex tests !
The best place to ask questions on how to use Karate or if you get stuck is the Karate "tag" on Stack Overflow.