Archives For November 30, 1999


Coded UI Tests can fail for a number of reasons, producing detailed logs that can be used to rapidly identify what caused the failure. The interesting characteristic about the logs produced by the tests, is that each action results in a detailed entry consisting of information about the how to find the control, the technology used to find the control and a screenshot of the action including a red box above the control upon which the action is performed. These details can help identify if the CUIT has been able to find the right control. It can also help locate instances where the target control is missing.

image

Continue Reading…


Data-Driven Coded UI Tests are great at testing screens with data permutations. In this example I am using data stored in a CSV file as a Data Source.

The application under test is a simple WPF login screen.

Login Screen

Get the code @ https://github.com/brisebois/Coded.UI.Test.Demoware

Continue Reading…


Whether you are working with one or many UIMaps the best way to add a UI Control to a UI Control Map , without adding a UI Action, is to right click on the UIMap to which you want to add the control and select
Edit With Coded UI Test Builder”.image

This will open the Coded UI Test Builder

image_thumb13

Be sure that the application under test is running.

image_thumb596 image_thumb638

Once the application under test is running, click and drag the bull’s-eye to the desired control. The selected control will be identified by a blue border.

image

image Releasing the left mouse button over the desired control will bring up a new window containing information about the control.

Clicking on the “UI Control Map” tab to the left of this new window will give you more options.

Amongst the options presented to you, is a button that allows you to add the control to your
UI Control Map without adding a new UI Action to the UIMap.

Click on the first icon:
Add control to UI Control Map

image

    
Once the control is added the checkmark located next to the control will become black. To save this control to the
UI Control Map click on the 4th icon located in the Coded UI Test Builder “Generate Code”

image  A window will popup with a note mentioning that no Method Name is required because no UI Action will be generated.

imageThe last step, clicking “Generate” will generate the elements required to include the newly mapped control in the UIMap.

The UI Control will available from code once the project gets built.

 

 

 

Get the code @ https://github.com/brisebois/Coded.UI.Test.Demoware

Test For Positives

September 30, 2012 — Leave a comment

When you build your test plans, it’s quite important to keep in mind that testing for positives is always easier to maintain. Furthermore, by testing for positives, you are effectively testing and documenting your actual requirements.

Tests should follow what I call the golden path. The golden path is the most direct path to reach your goal without taking any of the permutations into account. This means that If I’m testing a login screen, I will test each of its features separately.  Just to be clear, a failed login which provides the user with the proper feedback is a feature. Error messages are part of the requirements and should have specific tests.

Don’t test for unknowns. Testing for something that is undefined or unpredictable can greatly complicate your test plans and can lead to false positives. Testing for negations can pretty much result the same way.


image_thumb[59]The following example, will be using Coded UI Tests (CUIT) and Visual Studio 2012 Premium to test the login window for a small WPF application.

The Login Test Application is quite simple and composed of two WPF windows. The sole purpose of the first window is to create and show the  Login window.

The Login window is composed of a user name, a password (clear text), a login button and an error message. image_thumb[63]

The first step to building maintainable Coded UI Tests is to build a UIMap per application screen. The goal here is to keep the UIMaps as simple as possible. It’s strongly recommended to regularly prune UIMaps by removing unused controls from the UI Control Map and unused UI Actions. Doing this will greatly simplify future modifications and additions to the UIMap.

Get the code @ https://github.com/brisebois/Coded.UI.Test.Demoware

Continue Reading…


image When ever you have admin rights to your computer, be sure to run Visual Studio as Administrator. This will greatly reduce the number of headaches cause by tools who don’t react the way you expect them to.

Visual Studio is quirky when it comes to user rights. In some cases, it will misbehave and you might not notice it. One example of this can be observed when you are working with Coded UI Tests (CUIT), when Visual Studio is not running as Administrator, the recorder will not have access to all the control properties that are required. This can quickly lead you to think that the tool isn’t worth much!

Another instance where Visual Studio must be running as Administrator, is when you need to create a website under IIS from within Visual Studio. When it isn’t running under Administrator privileges, it will block you and warn you that you need elevated privileges. This is one of the rare instances where Visual Studio explicitly tells you that you that you are required to start it as an Administrator. This is because IIS requires elevated privileges.

imageThese are but two examples of why it is so important to run Visual Studio as an Administrator.

The image to the right, shows 
how to set
Visual Studio to always start as Administrator. Right click on the shortcut and go into the advanced… menu. Then be sure to check the Run as administrator check box.  

Remember, when ever you have the possibility, it’s best run Visual Studio with full admin rights.


When using Coded UI Tests (CUIT) to  test large applications, it’s recommended to create individual UIMaps for each screen.

I used the following container to configure multiple UIMaps to point to the same root element. I can use the container to fetch the UIMaps when I need them.

Using this container can help build maintainable Coded UI Tests.

Get the code @ https://github.com/brisebois/Coded.UI.Test.Demoware

Continue Reading…