CUITe (Coded UI Test enhanced) Framework is a thin layer developed on top of Microsoft Visual Studio Team Test's Coded UI Test engine which helps reduce code, increases readability and maintainability, while also providing a bunch of cool features for the automation engineer.
- HTML
- WPF
- WinForms
- Silverlight
- Visual Studio 2010 Ultimate or Premium with Feature Pack 2
- Visual Studio 2012 Ultimate or Premium
- Visual Studio 2013 Ultimate or Premium
- Visual Studio 2015 Enterprise
Install CUITe using NuGet and make sure you include prerelease packages.
Install CUITe using the NuGet Package Manager:
Install-Package CUITe -Pre
If your intent is to test HTML you might also want to install Selenium components for Coded UI Cross Browser Testing.
The NuGet package to install depends on the Visual Studio version you are using.
Install CUITe for Silverlight using the NuGet Package Manager:
Install-Package CUITe.Silverlight.VS2010 -Pre
Install CUITe for Silverlight using the NuGet Package Manager:
Install-Package CUITe.Silverlight.VS2012 -Pre
You should also install the extension Microsoft Visual Studio 2012 Coded UI Test Plugin for Silverlight.
Install CUITe for Silverlight using the NuGet Package Manager:
Install-Package CUITe.Silverlight.VS2013 -Pre
You should also install the extension Microsoft Visual Studio 2013 Coded UI Test Plugin for Silverlight.
As best practice, we recommend writing object repositories for a more object-oriented approach to testing. Object repositories can more easily be created using the object recorder instead of manually creating them for HTML web pages. For more information see Recording objects using the CUITe Object Recorder or more code examples here.
Here are simple examples of testing filling out a form:
// Launch the web browser and navigate to the homepage
BrowserWindowUnderTest browserWindow = BrowserWindowUnderTest.Launch("https://website.com");
// Enter the first name
browserWindow.Find<HtmlEdit>(By.Id("FirstName")).Text = "John";
// Enter the last name
browserWindow.Find<HtmlPassword>(By.Id("LastName")).Text ="Doe";
// Click the Save button
browserWindow.Find<HtmlInputButton>(By.Id("Save")).Click();
// Launch the application
ApplicationUnderTest.Launch(@"C:\path to your application.exe");
// Find the main window of your application
WpfWindow window = new WpfWindow(By.Name("Main Window Title"));
// Enter the first name
window.Find<WpfEdit>(By.Name("FirstName")).Text = "John"
// Enter the last name
window.Find<WpfEdit>(By.Name("LastName")).Text = "Doe";
// Click on the Save button
window.Find<WinButton>(By.Name("Save")).Click();
// Launch the application
ApplicationUnderTest.Launch(@"C:\path to your application.exe");
// Find the main window of your application
WinWindow window = new WinWindow(By.Name("Main Window Title"));
// Enter the first name
window.Find<WinEdit>(By.Name("FirstName")).Text = "John"
// Enter the last name
window.Find<WinEdit>(By.Name("LastName")).Text = "Doe";
// Click on the Save button
window.Find<WinButton>(By.Name("Save")).Click();
// Launch the browser where the silverlight application is hosted
BrowserWindowUnderTest browser = BrowserWindowUnderTest.Launch("https://website.com");
// Enter the first name
browser.Find<SilverlightEdit>(By.AutomationId("FirstName")).Text = "John";
// Enter the last name
browser.Find<SilverlightEdit>(By.AutomationId("LastName")).Text = "Doe";
// Click on the Save button
browser.Find<SilverlightButton>(By.AutomationId("Save")).Click();
The CUITe Object Recorder supports recording objects from an HTML web page only.
-
Launch the CUITe Object Recorder from the location where the NuGet package was installed.
For example, launch /packages/CUITe.VS2013.x.x.x/tools/CUITe_ObjectRecorder.exe, relative to your solution.
-
Enter the full address of your web page in the Address field (ex. http://website.com).
-
Click on the 'Record' button.
-
Click on the objects you want to record actions against.
-
Click on the 'Code' button.
-
Copy the code and paste it in a new file in your Coded UI Test project.
-
Change the placeholder '$ProjectNameSpace$' with your namespace.
-
Use the class and generated code in a more object-oriented fashion:
// Launch the web page
MyObjectRepository browserWindow = BrowserWindowUnderTest.Launch<MyObjectRepository>("https://website.com");
// Enter the first name
browserWindow.FirstName.Text = "John";
// Enter the last name
browserWindow.LastName.Text ="Doe";
// Click on the Save button
browserWindow.Save.Click();