Package com.azure.android.core.test
Class TestContextManager
- java.lang.Object
-
- com.azure.android.core.test.TestContextManager
-
public class TestContextManager extends java.lang.Object
This class handles managing context about a test, such as custom testing annotations and verifying whether the test is capable of running.
-
-
Constructor Summary
Constructors Constructor Description TestContextManager(java.lang.reflect.Method testMethod, java.net.URL unitTestOutDir, TestMode testMode)
Constructs aTestContextManager
based on the test method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
didTestRun()
Returns whether the current test was ran.boolean
doNotRecordTest()
Returns whether the test should have its network calls recorded during arecord
test run.TestMode
getTestMode()
Returns the mode being used to run tests.java.lang.String
getTestName()
Returns the name of the test being ran.java.lang.String
getTestPlaybackRecordingName()
Returns the name of the playback record for the test being ran.java.net.URL
getUnitTestOutDir()
Get the output directory where UT artifacts are stored.
-
-
-
Constructor Detail
-
TestContextManager
public TestContextManager(java.lang.reflect.Method testMethod, java.net.URL unitTestOutDir, TestMode testMode)
Constructs aTestContextManager
based on the test method.- Parameters:
testMethod
- Test method being ran.unitTestOutDir
- The output directory where UT artifacts are stored.testMode
- TheTestMode
the test is running in.
-
-
Method Detail
-
getTestName
public java.lang.String getTestName()
Returns the name of the test being ran.- Returns:
- The test name.
-
getUnitTestOutDir
public java.net.URL getUnitTestOutDir()
Get the output directory where UT artifacts are stored.- Returns:
- The output directory where UT artifacts are stored.
-
getTestPlaybackRecordingName
public java.lang.String getTestPlaybackRecordingName()
Returns the name of the playback record for the test being ran.- Returns:
- The playback record name.
-
getTestMode
public TestMode getTestMode()
Returns the mode being used to run tests.- Returns:
- The
TestMode
being used to run tests.
-
doNotRecordTest
public boolean doNotRecordTest()
Returns whether the test should have its network calls recorded during arecord
test run.- Returns:
- Flag indicating whether to record test network calls.
-
didTestRun
public boolean didTestRun()
Returns whether the current test was ran.- Returns:
- Flag indicating whether the current test was ran.
-
-