Class LegerityTestClass
Defines a base class for running tests with the Legerity framework.
Inheritance
Namespace: Legerity
Assembly: Legerity.Core.dll
Syntax
public abstract class LegerityTestClass : object
Constructors
| Improve this Doc View SourceLegerityTestClass()
Initializes a new instance of the LegerityTestClass class.
The Options will need to be set before calling StartApp(Func<IWebDriver, Boolean>, Nullable<TimeSpan>, Int32).
Declaration
protected LegerityTestClass()
LegerityTestClass(AppManagerOptions)
Initializes a new instance of the LegerityTestClass class with application launch option.
Declaration
protected LegerityTestClass(AppManagerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| AppManagerOptions | options | The application launch options. |
Properties
| Improve this Doc View SourceApp
Gets the instance of the started application.
This could be a
Declaration
protected RemoteWebDriver App { get; }
Property Value
| Type | Description |
|---|---|
| RemoteWebDriver |
Remarks
This instance should not be used in parallelized test runs. Instead, use the instance returned by the StartApp(Func<IWebDriver, Boolean>, Nullable<TimeSpan>, Int32) or StartApp(AppManagerOptions, Func<IWebDriver, Boolean>, Nullable<TimeSpan>, Int32) method.
Apps
Gets or sets the instances of started applications.
Declaration
protected IReadOnlyCollection<RemoteWebDriver> Apps { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyCollection<RemoteWebDriver> |
Remarks
This is useful for accessing drivers in parallelized tests.
Options
Gets or sets the model that represents the configuration options for the AppManager.
Declaration
protected AppManagerOptions Options { get; set; }
Property Value
| Type | Description |
|---|---|
| AppManagerOptions |
Methods
| Improve this Doc View SourceStartApp(Func<IWebDriver, Boolean>, Nullable<TimeSpan>, Int32)
Starts the application ready for testing.
Declaration
public virtual RemoteWebDriver StartApp(Func<IWebDriver, bool> waitUntil = null, TimeSpan? waitUntilTimeout = null, int waitUntilRetries = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IWebDriver, System.Boolean> | waitUntil | An optional condition of the driver to wait on until it is met. |
| System.Nullable<TimeSpan> | waitUntilTimeout | An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception. |
| System.Int32 | waitUntilRetries | An optional count of retries after a timeout on the wait until condition before accepting the failure. |
Returns
| Type | Description |
|---|---|
| RemoteWebDriver | The configured and running application driver. |
Exceptions
| Type | Condition |
|---|---|
| DriverLoadFailedException | Thrown when the application is null, the session ID is null once initialized, or the driver fails to configure correctly before returning. |
| LegerityException | Thrown when:
|
StartApp(AppManagerOptions, Func<IWebDriver, Boolean>, Nullable<TimeSpan>, Int32)
Starts the application ready for testing.
Declaration
public virtual RemoteWebDriver StartApp(AppManagerOptions options, Func<IWebDriver, bool> waitUntil = null, TimeSpan? waitUntilTimeout = null, int waitUntilRetries = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| AppManagerOptions | options | The optional options to configure the driver with. Settings this will override the Options if previously set. |
| Func<IWebDriver, System.Boolean> | waitUntil | An optional condition of the driver to wait on until it is met. |
| System.Nullable<TimeSpan> | waitUntilTimeout | An optional timeout wait on the conditional wait until being true. If not set, the wait will run immediately, and if not valid, will throw an exception. |
| System.Int32 | waitUntilRetries | An optional count of retries after a timeout on the wait until condition before accepting the failure. |
Returns
| Type | Description |
|---|---|
| RemoteWebDriver | The configured and running application driver. |
Exceptions
| Type | Condition |
|---|---|
| DriverLoadFailedException | Thrown when the application is null, the session ID is null once initialized, or the driver fails to configure correctly before returning. |
| LegerityException | Thrown when:
|
StopApp()
Stops the App and any running Appium or WinAppDriver server.
Declaration
public virtual void StopApp()
StopApp(RemoteWebDriver, Boolean)
Stops an application, with an option to stop the running Appium or WinAppDriver server.
Declaration
public virtual void StopApp(RemoteWebDriver app, bool stopServer = false)
Parameters
| Type | Name | Description |
|---|---|---|
| RemoteWebDriver | app | The |
| System.Boolean | stopServer | An optional value indicating whether to stop the running Appium or WinAppDriver server. Default, false. |
StopApp(Boolean)
Stops the App, with an option to stop the running Appium or WinAppDriver server.
Declaration
public virtual void StopApp(bool stopServer)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | stopServer | An optional value indicating whether to stop the running Appium or WinAppDriver server. |
StopApps(Boolean)
Stops all running application drivers, with an option to stop the running Appium or WinAppDriver server.
Declaration
public virtual void StopApps(bool stopServer = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | stopServer | An optional value indicating whether to stop the running Appium or WinAppDriver server. Default, true. |