Using Different Web Browsers with Coded UI Tests
Coded UI tests can automate testing for web applications by recording your tests using Internet Explorer. You can then customize your test and play it back using either Internet Explorer or other browser types for these web applications.
Requirements
-
Visual Studio Ultimate or Visual Studio Premium
-
Operating systems:
-
Microsoft Windows 7
-
Microsoft Windows 8
-
Microsoft Windows Server 2008 R2 SP1
-
-
Web browser versions:
-
Windows Internet Explorer 9
-
Windows Internet Explorer 10
-
For supported versions of Mozilla Firefox and Google Chrome, go here
-
-
Install the Selenium components for Coded UI Cross Browser Testing.
What’s supported across all web browsers?
-
Add custom code for controlling features such as properties, search, and playback waiters.
-
Pop-ups and dialog boxes
-
Search resilience (using smart match) and performance improvements
By testing your web application using a variety of web browser types, you better emulate the UI experience of your users who may run different browsers. For example, your application might include a control or code in Internet Explorer that is not compatible with other web browsers. By running your coded UI tests across other browsers, you can discover and correct any issue before it impacts your customers.
Recording: You must use the Coded UI Test Builder to record your web application test using Internet Explorer. You can optionally add validation and custom code for the tested controls using a predefined set of properties as you would normally do for coded UI tests. For more information, see Verifying Code by Using UI Automation.
Note
|
|---|
|
You cannot record coded UI tests using Google Chrome or Mozilla Firefox browsers. |
Play back with Internet Explorer: When no browser is explicitly specified, tests will run on Internet Explorer by default. You can explicitly state the browser to be used by setting the BrowserWindow.CurrentBrowser property in your test code. For Internet Explorer, this property should be set to IE or Internet Explorer.
Play back with non-Internet Explorer web browsers: To play back on non-Internet Explorer web browsers, change BrowserWindow.CurrentBrowser property in your test code to either Firefox or Chrome.
To play back tests on non-IE web browsers, you must install the Selenium components for Coded UI Cross Browser Testing.
Installing Selenium components
-
On the Tools menu, choose Extensions and Updates.
-
In the Extension and Updates dialog box, search for Selenium components for Cross Browser Testing.
-
Highlight the extension and choose Download.
Tip
You can also download the Selenium components for Coded UI Cross Browser Testing from here.
For more information about creating and using coded UI tests, see Creating Coded UI Tests.
To enable debugging your web application, you must complete the following configuration options:
-
Enable Just My Code:
-
On the Tools menu, choose Options and then choose Debugging.
-
Select Enable Just My Code.
-
-
Disable CLR exceptions:
-
On the Debug menu, choose Exceptions.
-
For Common Language Runtime Exceptions, uncheck User-unhandled.
-
Apple Safari web browser is not supported.
You can configure the output to include screenshots in the coded UI logs. To do so, you need to set some configuration settings in the QTAgent32.exe.config file. By default, this file is installed in the following location: