Skip to content

Karate UI

Peter Thomas edited this page Jul 26, 2017 · 22 revisions

Introduction

Karate includes a UI in the 'karate-core' JAR itself from version 0.5.0 onwards. While experimental right now, it should mature rapidly with feedback (and hopefully code pull-requests) so that it becomes an integral part of the test dev experience.

Here is a preview of what it can do: Video

Java API

While you can choose a file from the 'File' menu, things are designed so that you can 'script' it to open the feature file you are working on, and save significant time - not needing to fiddle with browsing around and selecting files via the UI.

import com.intuit.karate.ui.App;
import org.junit.Test;

public class CatsUiRunner {
    
    @Test
    public void testApp() {
        App.run("src/test/java/demo/cats/cats.feature", "dev");
    }    
    
}

So just running the above 'as a JUnit test' would load the specified feature file with the karate.env set to dev.

You can also do this to just bring up the UI after which you can use the File-->Open menu to manually choose a file.

App.main(new String[]{});

The advantage of doing this from within your project is that in case you are using Java interop or depending on any JAR-s in the maven classpath (dependencies) - Karate would work correctly even within the UI process.

Postman Import

This is experimental, but can load most Postman collections. Use the Import-->Open menu for this.

Once converted to a Karate script, you can view the "Raw" form and cut and paste. Saving to the file-system is not yet implemented.