-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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.
You will be able to view and edit files, but for running tests, you need at least a PLUS subscription.
How to sign in and the differences between PLUS and PRO are explained here: Subscribe
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).
You can use the Karate Maven archetype to create a simple starter project. Or you can go to the next section which is a bit simpler: Cloning the Karate Template
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
.
Instead of using the Maven Archetype, 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. If Git is not installed, IntelliJ can do it for you, which is very convenient.
- 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.
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.