locked
Examples hand coding CUIT

    Question

  • I am finding it hard to pick up hand coding tests for CUIT.

    Are there any examples that I can look at that would help me make a start?

    Thanks.

    Wednesday, February 23, 2011 3:19 PM

Answers

  • CUITe (Coded UI Test enhanced) Framework is something that may interest you. This is good if you want to do hand-coding and has the concept of 'Object Repository' properly implemented.  A simple Object Repository (== UIMap) class will look like this:

        public class SATHome : Common
        {
            public CUITe_HtmlHyperlink lnkTermsOfUse = new CUITe_HtmlHyperlink("InnerText=Terms of Use");
            public CUITe_HtmlInputButton btnNext = new CUITe_HtmlInputButton("Id=ctl00_btnNext");
        }

    The test code is readable and maintainable. Handling a Search Results table is more logical as you can see below.

            pgSATHome.lnkTermsOfUse .Click();
            TermsOfUse pgTermsOfUse = CUITe_BrowserWindow.GetBrowserWindow<TermsOfUse>();
            pgTermsOfUse.txtApplicationName.SetText("Test App by Automation");
            pgTermsOfUse.btnSearch.Click();
            pgTermsOfUse.tblSearchResult.FindRowAndDoubleClick(3,"Active",CUITe_HtmlTableSearchOptions.NormalTight);

    CUITe also have a number of features like ability to inject JavaScript code (even large js functions) dynamically into DOM and eval it.

    Data driving test cases with multiple data files won't be an issue at all.

    Tuesday, March 15, 2011 12:33 PM

All replies

  • To my knowledge we do not have a tagetted doc to address hand coding but you can get enough data to understand the basic APIs.

    Refer 'Creating coded UI tests to automate your user interface' from the following page to understand about the available APIs

    http://msdn.microsoft.com/en-us/library/dd465178.aspx

    Following is the content index page for most of the blog topics related to Coded UI Test:

    http://blogs.msdn.com/b/mathew_aniyan/archive/2010/02/11/content-index-for-coded-ui-test.aspx

     

    If you are facing any issues during hand coding you can post your query on this forum.

    Wednesday, February 23, 2011 6:22 PM
  • Thanks for your reply Deepak.

    The content index is something that I have gone through already, however I am looking for coded examples. I am looking for ideas on how to structure a test regression pack and how to data drive these tests usings multiple data files.

    Thursday, February 24, 2011 8:30 AM
  • CUITe (Coded UI Test enhanced) Framework is something that may interest you. This is good if you want to do hand-coding and has the concept of 'Object Repository' properly implemented.  A simple Object Repository (== UIMap) class will look like this:

        public class SATHome : Common
        {
            public CUITe_HtmlHyperlink lnkTermsOfUse = new CUITe_HtmlHyperlink("InnerText=Terms of Use");
            public CUITe_HtmlInputButton btnNext = new CUITe_HtmlInputButton("Id=ctl00_btnNext");
        }

    The test code is readable and maintainable. Handling a Search Results table is more logical as you can see below.

            pgSATHome.lnkTermsOfUse .Click();
            TermsOfUse pgTermsOfUse = CUITe_BrowserWindow.GetBrowserWindow<TermsOfUse>();
            pgTermsOfUse.txtApplicationName.SetText("Test App by Automation");
            pgTermsOfUse.btnSearch.Click();
            pgTermsOfUse.tblSearchResult.FindRowAndDoubleClick(3,"Active",CUITe_HtmlTableSearchOptions.NormalTight);

    CUITe also have a number of features like ability to inject JavaScript code (even large js functions) dynamically into DOM and eval it.

    Data driving test cases with multiple data files won't be an issue at all.

    Tuesday, March 15, 2011 12:33 PM