How can i test the Telerik RadGrid using NUnit?

Thread is closed for posting
4 posts, 0 answers
  1. sreejith prakash
    sreejith prakash avatar
    2 posts
    Member since:
    Dec 2009

    Posted 01 Dec 2009 Link to this post

    I created a web project in ASP.net .In that I used Rad Grid component of Telerik.I want to test a class file in that the function contains radgrid object as parameter.The fuctions  will cahnge the proeryies dyanmically  while running the web project(eg: clear row selections ).How can i test those functions using Nunit.? Please help

    with regards
     Sreejith
  2. Missing user
    Missing user avatar

    Posted 01 Dec 2009 Link to this post

    Hi Sreejith,

    Based on your description, please try recording your test as a user would interact with the page. Then run the test, and for any step that fails you can double click on the red 'X' for that step.

    A failure resolution screen should then appear. If any of the page elements are not found with an error like 'Unable to locate recorded element', you can edit the find params on that screen as in this video.

    Please edit the find params to something that will be true for that created grid element at runtime using the find methods (TagIndex, AttributesOnly, XPath, Content). You can also use partial finds for the attributes and content to find the element you are looking for.

    The new beta version uses an upgraded find expression scheme that can chain these find params together. So if the 2009.2 924 WebUI version is not working out for you, please try recording the test in the beta with its auto generated find expressions.

    You can also edit the find expression in the beta similarly to the 2009.2 924 version, but with the options to add Atrributes from the pre-generated list or adding your own custom find expression. You can add a custom find expression by:
     
    1) Double clicking into the first empty box and select from the list (TextContent, InnerList,...)
    2) Select the drop down find method (Exact, Contains,...)
    3) Select your custom find text

    All the best,
    Nelson Sin
    the Telerik team

    Quick Edit: About NUnit, here is a video on code and Unit Test conversion from your WebAii test.

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. sreejith prakash
    sreejith prakash avatar
    2 posts
    Member since:
    Dec 2009

    Posted 01 Dec 2009 Link to this post

    I want to test that using NUnit 2.0 testing tool.I will give u an example of the function that to be tested.
     public static Boolean SalTblClearSelection(RadGrid radObj)
        {
            Boolean bOk = false;
            try
            {
                radObj.SelectedIndexes.Clear();
                bOk = true;
            }
            catch (Exception ex)
            {
                bOk = false;
            }
            return bOk;
        }

    How can i test this By using NUNIT testing Tool?

  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 02 Dec 2009 Link to this post

    Hello sreejith,

    In addition to the videos Nelson pointed to you in the previous response, please also take a look at the

    Getting Stated with WebAii Testing Framework and NUnit

    Note, the object the testing framework works with are wrappers of the actual control (e.g. RadGrid). The wrappers come built-in with the testing framework, which is also a subset of WebUI Test Studio.

    Note, v2.0 of WebUI Test Studio provides built-in "Convert to VSUnit, NUnit, xUnit, MbUnit" options so that as soon as you record your test you can convert it to the framework per your choice.

    Kind regards,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top