This is a migrated thread and some comments may be shown as answers.

How can i test the Telerik RadGrid using NUnit?

3 Answers 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sreejith prakash
Top achievements
Rank 1
sreejith prakash asked on 01 Dec 2009, 01:55 PM
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

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 01 Dec 2009, 04:39 PM
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.
0
sreejith prakash
Top achievements
Rank 1
answered on 02 Dec 2009, 05:26 AM
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?

0
Konstantin Petkov
Telerik team
answered on 02 Dec 2009, 11:00 AM
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.
Tags
General Discussions
Asked by
sreejith prakash
Top achievements
Rank 1
Answers by
Missing User
sreejith prakash
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Share this question
or