1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

KarateをProxy環境下で実行する

Posted at

はじめに

Karateは、Cucumberと同様のBDD(ビヘイビア駆動開発)を行うためのフレームワークであり、Gherkinの文法を自然言語に近い形で記述できるユニットテストツールです。
Karateについては、以下を参照してください。

Proxy 環境下での実行

Karateは、HTTP/HTTPS経由でテストを行うため、Proxyの影響を受けます。
Proxy環境下で実行したい場合は、karate-config.js で、以下の★印部分のように指定します。

karate-config.js
function() {    
  var env = karate.env; // get system property 'karate.env'
  karate.log('karate.env system property was:', env);
  if (!env) {
    env = 'dev';
  }
  var config = {
    env: env,
    myBaseUrl: 'http://localhost:8089',
    myVarName: karate.properties['MY_VAR_NAME']
  }
  if (env == 'dev') {
    // customize
    // e.g. config.foo = 'bar';
  } else if (env == 'e2e') {
    // customize
  }

  // ★Proxy指定
  karate.configure('proxy', { uri: 'http://my.proxy.host:8080' });
  // 認証ありの場合
  // karate.configure('proxy', { uri: 'http://my.proxy.host:8080', username: 'myuser', password: 'mypass' });


  return config;
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?