Karate IDE
KarateIDE is:
KarateIDE is by far the best user experience for KarateDSL and Contract Testing!! Getting Started:
If you are interested on a deep dive into Contract Testing with KarateDSL, checkout:
FeaturesBlazing Fast tests StartupSave a few seconds on each test startup time. With While developing, debugging and manual exploring your APIs saving a few seconds on each run makes a huge difference!! Please Note: that classpath resources like compiled java classes (and also logback.xml) are cached by this java process. If you need to refresh any of those cached resouces just run If you are experiencing any trouble or want to rollback to standard process just set Generate Karate Tests from OpenAPI definitionsYou can generate Karate tests from OpenAPI definitions including one feature per OpenAPI endpoint. Each feature includes four scenarios: one for validation, one for http call, one inline example payload you can edit and run immediately and one scenario outline for each response code. This is how one autogenerated feature looks like: Generate Stateful Mocks and Start them from the Editor (or Tests Explorer side bar)You can generate stateful mocks from OpenAPI definitions: Generate Simpler Tests for Mock ValidationValidate your mocks with a set of simple generated Karate Tests. Because we delegate payload validation to ZenWave ApiMock OpenAPI wrapper these tests are much simpler than regular E2E tests. You should also validate your live API with this same set of tests to make sure your mocks are working as expected. See VerifyMocksTest.java for a JUnit example you can use in your pipeline. This is how you can generate them from your OpenAPI definition: Generate Tests that spans multiple API calls simulating Business FlowsAnd yes, you can reuse these karate features, generated from OpenAPI, and compose Business Flow tests with them. Just select in order the API calls you want to chain and Right-Click to select "KarateIDE Generate Business Flow Tests": This is how an autogenerated CRUD tests looks like (with payloads collapsed for simplicity). Now you only need edit how your data is chained from one call to the other (see also PetCRUD.feature for how a complete working example compares to this one): Generate Karate ProjectIf you are starting from scratch you can generate a fresh karate project base line: with pom.xml, karate-config.js, environment specific and credentials config files... Just run SmartPaste sample payload into new files in scenario outline examplesCopy sample payloads and paste with Ctrl+Shift+V into scenario outline examples row filename like column and and it will create a new file + example row for you. Many options to explore your logs and response payloadsKarateIDE offers you many options to explore your response data and output logs. Use Executions and Network Logs tree view to explore them. Replacing old Tests Explorer with native Test API from VSCodeWith the new Tests API, Visual Studio Code supports richer displays of outputs and diffs than was previously possible. This brings a lot of goodies to your user experience:
We also have replaced good old terminal with Output Channels for greater display flexibility of output logs and response payload. Auto ConfigurationYou can configure this extension Karate IDE Classpath Jar will update automatically to latest Karate version. For further configuration options see Configuration Section OpenAPI schemas and examples meets Karate MocksYou can now:
Navigate to ZenWave ApiMock for more details about this integration. Debug Karate ScriptsYou can also Debug Karate scripts inside KarateIDE. Karate Debug Server is provided by karate-core and we are also contributors to. You can:
https://twitter.com/KarateDSL/status/1167533484560142336 Configuration Options.vscode/launch.jsonWhen you click
Karate classpathYou have currently three options: Install KarateIDE Classpath Jar extension, manually download Karate "fat" jar from Karate Release or reuse local maven repo artifacts. If unsure just install KarateIDE Classpath Jar extension as it will automatically upgrade to each latest karate version. Please use Karate-IDE will honor your classpath settings when autocompletion and navigating/peeking code with Manual configuration: Using karate.jar (Karate fat jar)
Manual configuration: Using maven repository dependenciesIf you are already using maven and karate dependencies are already present in your maven local repository. KarateIDE will replace
If you need to add extra classpath jars you can use Run/Debug command templatesFor advanced users, Karate-IDE offers template based configurations for both Run and Debug commands. Variables with ${} will be replaced by KarateIDE runtime with actual values.
Multimodule projectsFor multimodule project, you may need to configure Karate java process will be started on that folder (first parent folder of current feature file containing a marker file) so classpath will be relative to that folder. Other functionalityKarate.env switcher, Karate Options and MockServer OptionsYou can switch SmartPaste from cURL in Karate filesCode Navigation and Definition PeekYou can navigate between files, features and scenario @tags using You can also navigate to scenarios by @tag in the same or in different feature file. It honors your classpath setting when navigating to files with Auto-CompletionWhen reading yml/json files are calling other features you can autocomplete their names with teh list of local and classpath files. It honors your classpath setting when navigating to files with Kill vscode.KarateTestProcess commandIf you are experiencing trouble with vscode.KarateTestProcess you can always run command Enjoy! |