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

Datagrid for Dummies

5 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Doyle
Top achievements
Rank 1
Doyle asked on 22 Apr 2014, 07:08 PM
I am very new to this testing tool and am tasked with converting our Excel test scripts to Automated Tests.

The challenge I have is that all the examples on the forum for what I am trying to do seem to be in C# and I work in VB - so there is a bit of a translation process there that seems to make things harder.

I need to find out two things from the Web pages we are testing:

First.  I have a Data Grid (not RadGrid) on a page with a column containing text like 'People', 'Places', 'Items' and so on.  To the right of this column I have an "Update" link.  I would like to select the row that the 'Items' text is in, and click on the "Update" link for that row in my test.

Secondly.  I have a RadMenu with a number of items in it that is generated dynamically from the database depending on the permission set of the user logging in.
User 1 might have 3 items - 'People', 'Places', 'Items' whereas User 2 only gets 'People' and 'Places'.  My test is to ensure that the 'Items' menu does NOT appear for User 2 and does appear for User 1.

The actual system is considerably more complex than what I have outlined here and I can't work off the number of items in the menu as User 2 may have 'People', 'Places' and 'Oranges' so both users would have the same number of items.

I know how to get to create a coded step, and have added a number of coded sql queries to verify data that has been entered in the system but the above two issues have held me up for days.

Help would be appreciated and in as basic (pardon the pun) a format as possible.  Step by Step would be ideal.

Thanks

5 Answers, 1 is accepted

Sort by
0
Doyle
Top achievements
Rank 1
answered on 25 Apr 2014, 04:40 PM
Well , almost three days later and I am still stuck on doing these checks manually.

Could someone let me know if what I am trying to do is even possible?  If not, I will have to continue with the manual checks.  If so, I will continue to resolve it.  If I do, I will post the answer here as I am sure someone else could use this information.
0
Cody
Telerik team
answered on 25 Apr 2014, 11:19 PM
Hi Doyle,

I apologize for the delay getting back to you. FYI, responding to support tickets takes priority over answering public forum posts.

FYI, we have an automatic C# <=> VB converter you can use. Yes we use C# primarily within Telerik. That's why most of our posted samples are in C#. Thus far I haven't found anything you can do in one language that you can't in the other. Maybe there is, but I'm not aware of it (granted I don't know a lot about VB and could be wrong).

Item 1) Yep, that does require code. Here's a VB sample:
Dim myTable As HtmlTable = ActiveBrowser.Find.ById(Of HtmlTable)("myUniqueTableID")
Dim myRow As HtmlTableRow = myTable.Find.ByContent(Of HtmlTableRow)("New Mexico")
Dim myLink As HtmlAnchor = myRow.Cells(4).Find.ByTagIndex(Of HtmlAnchor)("a", 0)
myLink.Click()

Item 2) Do you prefer to do this in code, or a non-coded step? You can record a Verify Exists or Verify Not Exists test step. Verify Not Exists is a little trickier. It has to exist before you can record it. Logon as a user that has it, but add it to the test for a user that is not supposed to have it.

If you want to use code let me know and I'll guide you.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Doyle
Top achievements
Rank 1
answered on 28 Apr 2014, 03:16 PM
Thank you Cody, that has moved me ahead a bit.

Firstly, is there a way to put Breakpoints in a coded step?

With the code above, I have put in Log entries for each step in the coded step and the process moves through the first line but seems to fail on the second, since I don't get back a Row ID

When it hits the third line, it fails with System.NullReferenceException: Object reference not set to an instance of an object.
I have verified that the value I am searching for is in Column 1 of the table. And looked at the Source and DOM to make sure it is there.

This is the source of the line I am trying to find and hit the link for:
<td>NatAdminTest</td><td align="center">National</td><td align="center">Admin</td><td><a href="javascript:__doPostBack('dgDataGrid$ctl05$ctl00','')">Update</a></td>

The table name is dgDataGrid and the entry is NatAdminTest.

Thank you




0
Cody
Telerik team
answered on 29 Apr 2014, 02:52 AM
Hi Doyle,

Firstly, is there a way to put Breakpoints in a coded step?

Not using standalone Test Studio. We do not have a built-in source code debugger. The alternative is to open the project in Visual Studio with our VS plug-in where you can use the Visual Studio source code debugger with breakpoints. I do this quite often.

...but seems to fail on the second, since I don't get back a Row ID

To help figure this out I'll really need to see the full DOM along with the exact code you're trying to use. You can get me the DOM by going to Step Failure Details, finding and clicking Export and sending me the .zip file it creates. Also include the code from your test. Then I'll be able to diagnose why it's not working as expected.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Doyle
Top achievements
Rank 1
answered on 29 Apr 2014, 04:54 PM
I would prefer not to do that in a public forum so I will create a ticket to continue with this.

Thanks
Tags
General Discussions
Asked by
Doyle
Top achievements
Rank 1
Answers by
Doyle
Top achievements
Rank 1
Cody
Telerik team
Share this question
or