AzureのApplication Insights Availability機能で「.webtest」をインポートしたいとします。私はVisual Studioのテスト版を持っていませんが、this MSDN articleは、Webテストを作成する別のオプションとしてFiddlerを使用するよう提案しています。 connect/token
エンドポイントからのベアラトークンVisual Studioを使用せずに「Webテスト」でベアラトークンを渡す?
- 要求:
私はREST APIの2つの要求を実行する必要があります。
- ヘッダー内のベアラトークン(上記の要求から取得)を使用して
api/resources
でGETを実行します。
これは一般的なクライアントの認証情報OAuth 2の流れです。
私はフィドラーでこれを行う方法を理解できないようです。
<?xml version="1.0" encoding="utf-8"?>
<TestCase Name="FiddlerGeneratedWebTest" Id="" Owner="" Description="" Priority="0" Enabled="True" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="" RequestCallbackClass="" TestCaseCallbackClass="">
<Items>
<Request Method="POST" Version="1.1" Url="https://example.com/connect/token" ThinkTime="8" Timeout="60" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8">
<Headers>
<Header Name="Content-Type" Value="application/x-www-form-urlencoded" />
</Headers>
<FormPostHttpBody ContentType="application/x-www-form-urlencoded">
<FormPostParameter Name="client_id" Value="myclientid" UrlEncode="True" />
<FormPostParameter Name="client_secret" Value="password123" UrlEncode="True" />
<FormPostParameter Name="grant_type" Value="client_credentials" UrlEncode="True" />
<FormPostParameter Name="scope" Value="myscopes" UrlEncode="True" />
</FormPostHttpBody>
</Request>
<Request Method="GET" Version="1.1" Url="https://example.com/api/resources" ThinkTime="0" Timeout="60" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8">
<Headers>
<Header Name="Authorization" Value="Bearer {{token}}" />
</Headers>
</Request>
</Items>
</TestCase>
は素晴らしい作品。このようなテストをVSテスト版なしで作成する方法はありますか?私が見ることのできるところから、Fiddlerは記録や再生要求以上のことはできません。 – davenewza