次の方法で共有


TestContextManager クラス

  • java.lang.Object
    • com.azure.core.test.TestContextManager

public class TestContextManager

このクラスは、カスタム テスト注釈などのテストに関するコンテキストの管理と、テストが実行できるかどうかを検証します。

コンストラクターの概要

コンストラクター 説明
TestContextManager(Method testMethod, TestMode testMode)

TestContextManagerテスト メソッドに基づいて を構築します。

TestContextManager(Method testMethod, TestMode testMode, boolean enableTestProxy, boolean recordWithoutRequestBodyClassAnnotation, Path testClassPath)

TestContextManagerテスト メソッドに基づいて を構築します。

メソッドの概要

修飾子と型 メソッドと説明
boolean didTestRun()

現在のテストが実行されたかどうかを返します。

boolean doNotRecordTest()

テストの実行中 RECORD に、テストのネットワーク呼び出しを記録する必要があるかどうかを返します。

TestMode getTestMode()

テストの実行に使用されているモードを返します。

String getTestName()

実行されているテストの名前を返します。

String getTestPlaybackRecordingName()

実行されているテストの再生レコードの名前を返します。

boolean isTestProxyEnabled()

テスト プロキシが有効になっている場合は を返します。

boolean skipRecordingRequestBody()

テストが実行 RECORD モード時に要求本文を記録しているかどうかを返します。

メソッドの継承元: java.lang.Object

コンストラクターの詳細

TestContextManager

public TestContextManager(Method testMethod, TestMode testMode)

TestContextManagerテスト メソッドに基づいて を構築します。

Parameters:

testMethod - 実行されているテスト メソッド。
testMode - TestModeテストがで実行されています。

TestContextManager

public TestContextManager(Method testMethod, TestMode testMode, boolean enableTestProxy, boolean recordWithoutRequestBodyClassAnnotation, Path testClassPath)

TestContextManagerテスト メソッドに基づいて を構築します。

Parameters:

testMethod - 実行されているテスト メソッド。
testMode - TestModeテストがで実行されています。
enableTestProxy - True を指定すると、外部テスト プロキシが使用されます。
recordWithoutRequestBodyClassAnnotation - テスト クラスに注釈が存在するかどうかを RecordWithoutRequestBody 示すフラグ。
testClassPath - テスト クラスのパス

メソッドの詳細

didTestRun

public boolean didTestRun()

現在のテストが実行されたかどうかを返します。

Returns:

現在のテストが実行されたかどうかを示すフラグ。

doNotRecordTest

public boolean doNotRecordTest()

テストの実行中 RECORD に、テストのネットワーク呼び出しを記録する必要があるかどうかを返します。

Returns:

テスト ネットワーク呼び出しを記録するかどうかを示すフラグ。

getTestMode

public TestMode getTestMode()

テストの実行に使用されているモードを返します。

Returns:

テストの TestMode 実行に使用される 。

getTestName

public String getTestName()

実行されているテストの名前を返します。

Returns:

テスト名。

getTestPlaybackRecordingName

public String getTestPlaybackRecordingName()

実行されているテストの再生レコードの名前を返します。

Returns:

再生レコード名。

isTestProxyEnabled

public boolean isTestProxyEnabled()

テスト プロキシが有効になっている場合は を返します。

Returns:

テキスト プロキシが有効になっている場合は True

skipRecordingRequestBody

public boolean skipRecordingRequestBody()

テストが実行 RECORD モード時に要求本文を記録しているかどうかを返します。

Returns:

テストで要求本文を記録するかどうかを示すフラグ。

適用対象