"b": 2, And the returned JSON is dynamic, the lastName will modify response.json via an embedded-expression. If you are looking for ways to do something only once per feature or across all your tests, see Hooks. Note that def can be used to assign a feature to a variable. } Since it is internally implemented as a JavaScript function, you can mix calls to read() freely wherever JavaScript expressions are allowed: Tip: you can even use JS expressions to dynamically choose a file based on some condition: * def someConfig = read('my-config-' + someVariable + '.json'). The results of the first call are cached, and any future calls will simply return the cached result instead of executing the JavaScript function (or feature) again and again. to customize rebase filename and/or output), Function to be called when displaying image comparison configuration in Karate HTML reports (e.g. }, Set the read timeout (milliseconds). In the case of the call of a JavaScript function, you can also pass a JSON array or a primitive (string, number, boolean) as the solitary argument, and the function implementation is expected to handle whatever is passed. The configure key here is report and it takes a JSON value. }] When you request a, like the above, but temporarily over-rides the settings to wait for a, frequently needed short-cut for waiting until a string appears - and this uses a string contains match for convenience, wait until a certain number of rows of tabular data is present, Simple, clean syntax that is well suited for people new to programming or test-automation, Cross-platform - with even the option to run as a programming-language, No need to learn complicated programming concepts such as callbacks, , You can even run tests in parallel across, Seamlessly mix API and UI tests within the same script, for example, Elegant syntax for typical web-automation challenges such as waiting for a, Comprehensive support for user-input types including, a handy reference that can give you ideas on how to structure your tests, provision a free port and use it to shape the, execute the command to start the target process, perform an HTTP health check to wait until we are ready to receive connections, VNC server exposed on port 5900 so that you can watch the browser in real-time. And as shown in the example below, having text in-line is useful especially when you use the Scenario Outline: and Examples: for data-driven tests involving Cucumber-style place-holder substitutions in strings. This is super-useful when you need to wait for say a table of slow-loading results, and where the table may contain fewer elements at first. Embedded expressions also make more sense in validation and schema-like short-cut situations. Karate has an elegant approach to handling any action such as click() that results in a new page load. Given this custom, user-defined Java class: This is how it can be called from a test-script via JavaScript, and yes, even static methods can be invoked: Note that JSON gets auto-converted to Map (or List) when making the cross-over to Java. { Test data can be within the main flow itself, which makes scripts highly readable. Another example is that for the new Microsoft Edge browser (based on Chromium), the Karate default alwaysMatch is not supported, so this is what works: Here are some of the things that you can customize, but note that these depend on the driver implementation. } A common use case is to mix API-calls into a larger test-suite, for example a Selenium or WebDriver UI test. The Runner.Builder API has a dryRun() method to switch this on. For tests that need to wait for slow pages or deal with un-predictable element load-times or state / visibility changes, Karate allows you to temporarily tweak the internal retry settings. Experience working in an Agile environment with agile methodologies leveraging Jira After you have switched, any future actions such as click() would operate within the selected