How the Telerik Testing Framework behaves during a test run is controlled by the settings contained in the Settings object. There are many settings you can take advantage of to modify its behavior to better meet your testing requirements or testing environment. The complete list of settings is detailed in the table below. A few of the more commonly used settings include:
- BaseUrl - Sets the base URL used by the NavigateTo command.
- DefaultBrowser - Controls which browser will be started by the LaunchNewBrowser command.
- EnableSilverlight - If you will be doing any Silverlight application settings, this must be set to True.
There are a few methods of controlling the settings in the Settings object. Which method you use depends on when and how you want them set in your unit test.
Initializing the Settings Object Without Using a Telerik Test Template
If you're not using one of Telerik's test templates (VsUnit, NUnit, MbUnit, xUnit) to create your unit test, you'll need to create your own Settings object and then pass that object as a parameter to the constructor of your Manager object. For example:
// Create my own Settings object and then modify the defaults
Settings mySettings =
mySettings.DefaultBrowser = BrowserType.FireFox;
mySettings.ClientReadyTimeout = 60000;
// Use my Settings object to construct my Manager object
Manager myManager =
' Create my own Settings object and then modify the defaults
mySettings.DefaultBrowser = BrowserType.FireFox
mySettings.ClientReadyTimeout = 60000
' Use my Settings object to construct my Manager object
Initializing the Settings Object When Using a Test Template
If you're using one of Telerik's test templates (VsUnit, NUnit, MbUnit, xUnit) to create your unit test, you'll need to create your own Settings object in the TestInitialize section (or Setup section if you're using NUnit) and then pass that object as a parameter to the Initialize method of the base class. For example:
// This will get a new Settings object. If a configuration
// section exists, then settings from that section will be
Settings settings = GetSettings();
// Override the settings you want. For example:
// Now call Initialize again with your updated settings object
' This will get a new Settings object. If a configuration
' section exists, then settings from that section will be
Settings = GetSettings()
' Override the settings you want. For example:
' Now call Initialize again with your updated settings object
Note: Be sure to call Initialize only once. Calling Initialize a second time will simply be ignored and you'll be left wondering why your settings did not take effect.
Changing Settings On-The-Fly
Lastly you can modify most of the settings after your test is already initialized and under-way. Here's how you to do that:
Manager.Settings.DefaultBrowser = BrowserType.FireFox;
Manager.Settings.DefaultBrowser = BrowserType.FireFox
Note: The following settings can only be set during initialization: AspNetDevServerPort, CreateLogFile, EnableUILessRequestViewing, LocalWebServer, LogLocation, VerboseHttpProxy and WebAppPhysicalPath.
Using the RecycleBrowser Feature
The RecycleBrowser feature was added in version 2.0. Using it can significantly speed up running an entire test suite, no more starting and shutting down of the browser for each individual unit test. It works by launching one browser window in the test fixture initialization of your test suite and then constantly reusing that same browser window for all unit tests contained in your test suite.
There are a just a couple of things you need to be aware of to properly use the RecycleBrowser feature:
- When RecycleBrowser is active, any Manager.LaunchNewBrowser or Browser.Close() calls will be ignored.
- You must call the base classes ShutDown() method in the test fixture teardown section to properly the browser window at the end of the test suite. If you miss this then browser windows will be left behind after your test suite has finished and exited.
Restoring Default Settings
If it ever becomes necessary you can restore all the settings (except for those that can only be set during initialization) back to their default values. Just use the Reset() method of the Settings object. For example:
|Name ||Description ||Possible Values ||Default Value |
|AnnotateExecution ||Controls whether or not to highlight/annotate the target elements that the requested action is being executed against. e.g. Actions.Click(goButton); ||true |
|AnnotationMode ||Controls what will be annotated when annotation is enabled. ||All |
|AspNetDevServerPhysicalPath ||This read-only setting contains the full physical path to your local ASP.NET development web server (WebDev.WebServer.EXE). It is set by the framework when LocalWebServer is set to "AspNetDevelopmentServer". Otherwise it is an empty string. || || |
|AspNetDevServerPort ||Controls the AspNetDevServer (if used) port. If this is not set (-1) a random port will be generated each time the manager is created. ||0 to int.MaxValue ||Random value |
|BaseUrl ||Sets the base URL to use for all NavigateTo() commands. When set NavigateTo() should use a relative URL (e.g. "~/default.aspx"). ||Any valid URL ||string.Empty |
|ClientReadyTimeout ||Timeout used to wait for a client (a browser) to be ready after it is first launched or after executing a command (in milliseconds). For example after launching the browser if the browser is not ready within this timeout the framework will throw a TimeoutException. ||0 to int.MaxValue ||30000 |
|CreateLogFile ||Gets or sets whether to create a log file on disk. This value is read once at initialization time. Changing this value during test execution has no effect. ||true |
|DefaultBrowser ||The default browser (i.e. Internet Explorer or Firefox or AspNetHost) to launch when calling Manager.LaunchNewBrowser(). ||"InternetExplorer" |
|EnableSilverlight ||Controls whether or not Silverlight test automation is enabled. ||true |
|EnableUILessRequestViewing ||Controls whether or not to allow debugging of UILess page requests using a UI browser like Internet Explorer. ||true |
|ExecuteCommandTimeout ||The amount of time to wait for a response to be received from the browser (in milliseconds) after sending it a command request. For example: if there is no response from the browser within this amount of time after sending it a click request, the framework will throw a TimeoutException. ||0 to int.MaxValue ||20000 |
|ExecutionDelay ||Sets the amount of execution delay (in milliseconds) between commands. This can help in observing test execution. ||0 to int.MaxValue ||0 |
|IsStressRecordingMode ||Used internally by Automation Design Canvas only. || || |
|IsUserInteractiveMode ||This read-only setting indicates whether or not the currently logged on user is an interactive user. Normally this will always be true unless you are logged in under a non-interactive account. For example, if you create another account on your machine and from your current account launch a process using that other account without interactively logging into that account. That is when this property will be set to false. This is a common scenario when performing continuous integration within a build system and running tests. Usually there is a machine that has an account that VisualStudio simply uses to logon the machine non-interactively, build a product and launch tests. ||true |
|Depends on run time environment |
|KillBrowserProcessOnClose ||Gets or sets whether to make sure the browser process is killed when closing the browser. Note: Firefox is a single process browser. If you are using multiple browser instances and this setting is on, it will kill all open instances of Firefox. ||true |
|LocalWebServer ||Controls whether or not to use the local ASP.NET development server. When set to true, be sure to set WebAppPhysicalPath to the full physical path of the root of your ASP.NET development server. ||None |
|LogAnnotations ||Controls whether to log annotations to the log file. ||true |
|LogLocation ||Location where all logging will be performed, both captured bitmaps and WebAii's log file. ||Any valid URI. ||C:\WebAiiLog\ |
|QueryEventLogErrorsOnExit ||Controls whether or not the Manager object will query Windows Application Event log on exit for any error logged from automation clients. Any errors will be logged to the test log. ||true |
|RecycleBrowser ||When set to true, one instance of the browser will be launched and recycled through out the entire test class and tests until Manager.Dispose is called. ||true |
|SimulatedMouseMoveSpeed ||Sets the simulated mouse move speed for Desktop.Mouse.Move()/DragDrop() operations in pixels/millisecond. Typically values are between 0.1f - 0.5f. ||0 to Single.MaxValue ||0.3 |
|UseHttpProxy ||Gets/Sets whether to use the built-in http proxy during automation. NOTE: will be forced to true when EnableSilverlight is set to true. ||true |
|VerboseHttpProxy ||Gets/Sets whether the HTTP proxy produces lots of tracing output. ||true |
|WaitCheckInterval ||Controls the rate that the condition is tested by the HtmlWait class. This value specifies the number of milliseconds to wait between tests of the condition. ||1 to int.MaxValue ||500 |
|WebAppPhysicalPath ||This setting is used when LocalWebServer is set to 'AspNetDevelopmentServer'. It must be the full physical path to the web application root that you are testing or a path relative to the location of the .config file. ||The full physical path to the web application root. ||string.Empty |