How To: Use CUITe

This is Syed Aslam Basha here from Relationship experience division (RXD) team.

 

CUITe is coded UI test enhanced framework available at https://cuite.codeplex.com/ useful for test UI automation. The advantages of CUITe is reduced code, better readability and maintainability. Let me show how to use CUITe.

  • Download and install from https://cuite.codeplex.com/

  • Launch CUITe_ObjectRecorder

  • Enter website address to test

  • image

  • Click on record

  • Click on the controls in web page

  • Click on Code button in the toolbar

  • It will generate the code as  shown below

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using CUITe.Controls.HtmlControls;

    namespace $ProjectNameSpace.$ObjectRepository
    {
       
           public class LoginWindow : CUITe_BrowserWindow
        {
            public new string sWindowTitle = "Server Login";
            public CUITe_HtmlEdit txtusername = new CUITe_HtmlEdit("Id=username");
            public CUITe_HtmlPassword txtpassword = new CUITe_HtmlPassword("Id=password");
            public CUITe_HtmlInputButton btnLogIn = new CUITe_HtmlInputButton("Value=Log In");

        }
    }

  • Create test project.

  • Record a normal Coded UI test to get all references done automatically.

  • Add reference to “CUITe.dll”  from the install path. Do not copy and reference.

  • Create objectrepository folder

  • Add a class file and rename it to LoginWindow

  • Copy paste the above code in a LoginWindow.cs file which will act as object repository. Update the name space and class name appropriately.

  • Can have inheritance work for object repository classes (move common stuff to parent classes for better organization and modularity).

  • In test methods you can call the objects as

LoginWindow.txtusername.SetText(username);

LoginWindow.txtpassword .SetText(password);

LoginWindow.btnLogIn .Click();

Note:

1. Object recorder now only works for html/web.

2. Object recorder only records the object/control definitions, not actions.

 

For more information refer the site https://cuite.codeplex.com/

 

- Syed Aslam Basha ( syedab@microsoft.com )

Relationship experience division (RXD) Team

Test Lead

Please leave a comment if the blog post has helped you.