CUITE not working ,not able to launch the application

Jun 7, 2014 at 1:34 AM
Hi Team ,

I'm a beginner in using CUITE framework , I have seen few videos on you tube and looks interesting and I'm excited to learn and use it for my project.

I have installed Visual Studio 2010 with feature pack 2 and have Cuite 1.05 installed on my machine.

The issue is , I'm not ale to execute Cuite code , worrying part is I'm not getting any runtime errors or build error, everything looks normal and not output.

This is the code I have in class file:

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

namespace CodedUITestProject1.Object_Repository
{
public class PALogin : CUITe_BrowserWindow
{
    public new string sWindowTitle = "Expedia Travel: Vacations, Cheap Flights, Airline Tickets & Airfares";
    public CUITe_HtmlRadioButton radoneway = new CUITe_HtmlRadioButton("Name=flight-type;Name=flight-type;Value=oneway");
    public CUITe_HtmlRadioButton radmulti = new CUITe_HtmlRadioButton("Name=flight-type;Name=flight-type;Value=multi");
    public CUITe_HtmlEdit txtflightorigin = new CUITe_HtmlEdit("Id=flight-origin");
    public CUITe_HtmlEdit txtflightdestination = new CUITe_HtmlEdit("Id=flight-destination");
}
}


This is the code I have it in coded ui test/cs file :


using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Input;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
using CUITe.Controls.HtmlControls;
using CodedUITestProject1.Object_Repository;

namespace CodedUITestProject1
{
/// <summary>
/// Summary description for CodedUITest1
/// </summary>
[CodedUITest]
public class CodedUITest1
{
    public CodedUITest1()
    {
    }

    [TestMethod]
    public void CodedUITestMethod1()
    {
        // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //this.UIMap.RecordedMethod1();
        CUITe_BrowserWindow.Launch("http://www.expedia.com/");

    }

    #region Additional test attributes

    // You can use the following additional attributes as you write your tests:

    ////Use TestInitialize to run code before running each test 
    //[TestInitialize()]
    //public void MyTestInitialize()
    //{        
    //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
    //}

    ////Use TestCleanup to run code after each test has run
    //[TestCleanup()]
    //public void MyTestCleanup()
    //{        
    //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
    //}

    #endregion

    /// <summary>
    ///Gets or sets the test context which provides
    ///information about and functionality for the current test run.
    ///</summary>
    public TestContext TestContext
    {
        get
        {
            return testContextInstance;
        }
        set
        {
            testContextInstance = value;
        }
    }
    private TestContext testContextInstance;

    public UIMap UIMap
    {
        get
        {
            if ((this.map == null))
            {
                this.map = new UIMap();
            }

            return this.map;
        }
    }

    private UIMap map;
}
}

as said in one of the video , I have recorded coded ui tests as mentioned.
Can someone please help me solve this issue.

Regards,
Rajesh
Jun 7, 2014 at 4:03 PM
Hi Team,


Can someone please help me on this issue , it would enable me to learn more about the framework. appreciate any help!



Thank you
Rajesh
Coordinator
Jun 7, 2014 at 4:10 PM
Edited Jun 7, 2014 at 4:21 PM
So what is the output when you run your test method, CodedUITestMethod1?

The code you pasted indicates that all the test method does is launch the web browser to www.expedia.com but there's no code that interacts with the web page.

I would think you'd want something like this:
PALogin loginPage = CUITe_BrowserWindow.Launch<PALogin>("http://www.expedia.com/");
loginPage.txtflightorigin.SetText("LAX");
loginPage.txtflightdestination.SetText("NYC");
// loginPage.submitButton.Click()
Jun 7, 2014 at 6:17 PM
Hi Icnocop,

Thanks for your response.

I have added the code and tried to debug it and below is the error which I'm receicing.,


Error 1 The non-generic method 'CUITe.Controls.HtmlControls.CUITe_BrowserWindow.Launch(string)' cannot be used with type arguments C:\Users\gunasra\Documents\Visual Studio 2013\Projects\CodedUITestProject2\CodedUITestProject2\CodedUITest1.cs 32 53 CodedUITestProject2


My testmethod looks like this :

[TestMethod]
    public void CodedUITestMethod1()
    {
        // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //this.UIMap.RecordedMethod1();
        CUITe_BrowserWindow.Launch("http://www.expedia.com/");
        PALogin loginPage = CUITe_BrowserWindow.Launch<PALogin>("http://www.expedia.com/");
        loginPage.txtflightorigin.SetText("LAX");
        loginPage.txtflightdestination.SetText("NYC");

Thanks,
Rajesh
Coordinator
Jun 7, 2014 at 7:33 PM
Hi Rajesh,

I recommend downloading the latest code from the "Source Code" tab, building it, and then reference its output assemblies instead.

Thank you.
Jun 8, 2014 at 3:09 AM
Hi icnocop,


Thank you so much , you have saved me !!, the solution given by you worked.


Regards,
Rajesh
Jun 8, 2014 at 7:25 PM
Hi Sir,


I'm able to launch application ; click on one of the object [which is weblement] , another object under it is also an Webelement.

Interesting thing is that it is not getting captured in object recorder tool ;I tried to manually capture the properties using both Recorder and F12 and used the below line to automated ; still it is not working not sure why and how.

CUITe_HtmlCustom custom = PALogin.Get<CUITe_HtmlCustom>("Class=workspace-desheading;Name=workspace_desc;InnerText=BBSprint23");
    Playback.Wait(2000);
    custom.Click();
Also, can you please share me a reliable method other than Playback.wait , I tried with "waitForControlReady" but not working as it should be.

Kindly direct me with your solutions!!...Thanks for your help!


Regards,
Rajesh
Coordinator
Jun 9, 2014 at 1:11 AM
Why are you using CUITe_HtmlCustom?
What does your HTML look like?
What is the error message and stack trace?
Jun 9, 2014 at 2:49 PM
Hello sir,
I have attached a image file showing how the html looks like.
The reason why I wanted to use html custom is this object could not be identified using the recorder and so from one of the discussions I came to know abt this custom object stuff and used it. Not sure why it didn't work or I'm not using the way it should be sued .
I will give you the error stack in a minute.
Code used:

CUITe_HtmlCustom custom = PALogin.Get<CUITe_HtmlCustom>("Class=workspace-desheading;Name=workspace_desc;InnerText=BBSprint23");

Playback.Wait(2000)

custom.Click();

Thanks for your time and support!!
Thanks &Regards,
Rajesh


Coordinator
Jun 10, 2014 at 6:49 AM
Sorry, I didn't get the image.

You can't attach images to discussions on codeplex, let alone as an attachment to an email, so maybe you can upload it somewhere else, and then paste the link so I can download it.

Can you actually paste the HTML code please?

Which HTML element are you trying to interact with?
Coordinator
Jun 11, 2014 at 12:28 PM
Please make sure your html is valid.

If you're trying to interact with an <h6> element, use the CUITe_HtmlHeading6 class.