まずは次のチュートリアルビデオをご覧ください。
時間は4分程度です。
上に英語、下に日本語で簡単な解説が流れます。
現時点では英語と日本語に対応しています。
画面右上のスイッチでお好みの言語を選択してください。
テスト対象のバックエンドの仕様によっては入力する量が多くなるかもしれませんが、
ほとんどの項目がAPI仕様書などからコピー&ペーストできますので、
慣れてしまえば操作の難易度はそれほど難易度は高くないと考えています。
さて、Karate Gherkin Visual Editorの仕様を説明していきます。
以下の画像をご覧ください。
テストシナリオのデータ構造のイメージです。

この構造を理解することで、どこで何を入力すれば良いかより深く理解できるかなと思います。
- フィーチャは、Karate Runnerで実行するファイルの単位です。1つの機能に対して1つ作成します。
- バックグラウンドは、フィーチャ全体で利用する値を「定数」としていくつも宣言することができます。
- シナリオは、1つのフィーチャにいくつでも書くことができます。1つの機能に対して、複数のシナリオを記述できます。
- ラウンドトリップは、1つのシナリオにいくつでも書くことができます。ラウンドトリップは1つのHTTPリクエストに対してレスポンスを受けるまでを表します。URLと期待するレスポンスコードの入力は必須です。
- 検証は1つのラウンドトリップに対していくつでも書くことができます。検証のために利用した変数がここで自動的に保存されますが、明示的に任意の名前をつけて、後続のラウンドトリップでそれを利用することができます。
何かを追加したい場合は、「+」ボタンを押すことで、すぐ下の行に空の入力部品が現れます。
また、削除したい場合は、「−」ボタンを押すことで、その入力内容を廃棄することができます。
テキストを入力する時は引用符で囲んでください。
シングルクォーテーション、ダブルクォーテーションのどちらでも構いません。
数値やtrue、falseの真偽値は囲む必要がありません。
変数や変数とテキストの結合式などの場合も、変数名は引用符で囲む必要はありません。
クッキーは自動的に引き継がれますので、後続のラウンドトリップで渡す必要はありません。
これはFlutterのバグの可能性が高いのですが、現在、有効なワークアラウンドを模索中です。
https://github.com/flutter/flutter/issues/58159
こんなテンプレートが欲しいなどといったご要望は弊社ホームページまで、ぜひよろしくお願いいたします。
ログインだけはフォームだったり、検証環境でも外部の認証サービスに飛ばされるというケースもあるかもしれませんが、
そういったシナリオ作成も可能です。
Karateの導入に関するサポートもお受けしておりますので、まずは弊社ホームページまでお気軽にお問い合わせください!
それでは!
In English
Watch the tutorial video at the top of this page first.
The time is about 4 minutes.
A brief commentary will be played in English above and in Japanese below.
At the moment, it supports English and Japanese.
Select your preferred language with the switch at the top right of the screen.
Depending on the specifications of the backend under test, you may have to enter a lot,
Most items can be copied and pasted from API specifications, etc.
Once you get used to it, the difficulty of operation is not so high.
Now, I will explain the specifications of Karate Gherikin Visual Editor.
Please see the image below.
An image of the data structure of a test scenario.

By understanding this structure, you will have a deeper understanding of where and what to enter.
- A feature is a unit of file that Karate Runner runs. Create one for each feature(function).
- The background can declare any number of values used throughout the feature as “constants”.
- You can write as many scenarios as you like on one feature. Multiple scenarios can be described for one function.
- You can write as many round trips as you like in one scenario. Round trip represents until a response is received for one HTTP request. Entering the URL and expected response code is mandatory.
- You can write as many verifications as you like for a round trip. The variables used for verifications are automatically saved here, but you can explicitly give them any name and use them in subsequent round trips.
If you want to add something, just press the “+” button and an empty input part will appear in the line immediately below.
If you want to delete it, you can discard the input contents by pressing the “-” button.
Enclose the text in quotation marks when entering it.
Either single quotation or double quotation can be used.
You do not need to enclose numbers or true or false values.
Variable names do not need to be quoted, even for variables and variable-text combinations.
Cookies are taken over automatically so you don’t have to pass them on subsequent round trips.
This is most likely a Flutter bug, but we’re currently looking for a valid workaround.
https://github.com/flutter/flutter/issues/58159
See you!