I have Kendo grid for my Inbox message page. The look is similar to gmail: Inbox (10) and "10 is the total number of message in my Inbox"
What I want to test is extract the number of message in my Inbox and verify with the number displaying in my label.
My first step: KendoGridExtract 'Data' item count into DataBlindVariable $(GridMessagesDiv) --> this line, I can see that the count is "10"
How do I use that count to verify part of my label?
When I record to verify the label; the TextContent displayed as "Inbox (10)"
Can I do it without coding?
13 Answers, 1 is accepted
KendoGridExtract 'Data' item count into DataBlindVariable $(GridMessagesDiv)
Verify 'TextContent' 'Contains' 'Inbox (10' on 'Inbox10Link' - DataDriven: [$(GridMessagesDiv)]
I ran that and it failed. I looked at the log and it said:
Content.TextContent of 'Inbox10Link' does not match!
Match Type: 'Contains'
Expected Result: 3
Value at time of failure: 'Inbox(10'
I'm confused why the expected result is "3" instead of "10"
Did I set the DataBindVariableName wrong in the first line? It is "GridMessagesDiv"
Thanks for helping!
The reason I was doing the extract first was to get the total item in the Inbox before I can verify if my label is correct. "10" was just an example when I recorded this test. It could be any number when I run this test. Does that make sense?
Can you please send me a screenshot of your Test Studio Recording, Failure msg and DataBind excel you used?
I can only provide you the recording steps and the failure msg. I'm missing the databind excel, maybe that's my problem. I'm not sure why I need a databind excel. I thought I can just record a step to extract the count so that I can use that count to verify it agains my label. Could you please explain what I need to do to accomplish this test?
In line 39, I extracted the count of the table. Please see my screen shot.
In line 40, I took that count and compared it with the number in my label. On this example, it's "10" next to the "Inbox (10)".
Instead of doing a verify test content on the next step, can you try doing an extract on that value also and then do a coded step to compare both the Variables
For a sample, i have named the second extract as "GridTitanInboxDiv"
Log.WriteLine("Mails in Grid: " + Data("GridTitanMessagesDiv"))
Log.WriteLine("Mails in Grid: " + Data("GridTitanInboxDiv"))
Assert.IsTrue(Data("GridTitanMessagesDiv") = Data("GridTitanInboxDiv"))
Thank you so much for helping!
I did the extract "TextContent" instead of verify on line 40. Then line 41, I added the code you provided. I got compile error: The name 'Data' does not exist in the current context in all 5 lines of code.
'8/20/2012 11:38:16 AM' - Using 'InternetExplorer' version '9.0' as default browser.
'8/20/2012 11:38:18 AM' - 'Pass' : 1. Navigate to : 'http://demos.kendoui.com/web/grid/editing-custom.html'
'8/20/2012 11:38:18 AM' - 'Pass' : 2. KendoGridExtract 'Data' item count into DataBindVariable $(Div)
'8/20/2012 11:38:18 AM' - 'Pass' : 3. Extract 'TextContent' on 'BasicUsageLink' into DataBindVariable $(BasicUsageLink)
'8/20/2012 11:38:18 AM' - LOG: Grid Count: 6
'8/20/2012 11:38:18 AM' - LOG: Email Link: Basic usage
'8/20/2012 11:38:18 AM' - 'Fail' : 4. [WebTest1_CodedStep] : New Coded Step
Exception thrown executing coded step: '[WebTest1_CodedStep] : New Coded Step'.
ArtOfTest.Common.Exceptions.AssertException: Assert.IsTrue - [Expected:True],[Actual:False]
at ArtOfTest.Common.UnitTesting.Assert.IsTrue(Boolean condition, String message)
at ArtOfTest.Common.UnitTesting.Assert.IsTrue(Boolean condition)
at WebTest_1_.WebTest1_CodedStep() in C:\Users\nrahul.BLCORP\Downloads\WebTest(1).tstest.vb:line 78
'8/20/2012 11:38:18 AM' - Detected a failure. Step is marked 'ContinueOnFailure=False' aborting test execution.
'8/20/2012 11:38:18 AM' - Overall Result: Fail
I have created a sample test performing a similar task against our KendoUI grid demo. Please find a screenshot attached. The item count for the data grid does update to reflect changes in the grid. Using similar steps should work in your scenario. I have also included coded steps to output the contents of the extracted variable to the log. These should help you debug your test. Nithin's coded steps are correct, but they are written in VB; your errors are consistent with a test that is using C#. You can change the code to the C# version, as per our article on using extracted variables in code:
You should replace the variable name as appropriate to your test. If this approach does not explain the changes in value, or indicates that the item count for the data grid is inaccurate, please provide us with a copy of your test and access to your application. Also, please provide your failure log and a copy of the DOM at the time of failure. You can export these to file from the failure tab for your test and add them to a .zip archive. If it is not possible to grant us access to your application, please take a Fiddler trace and attach it to a support ticket in a zip file. If you are unfamiliar with how to do that please refer to this short video. You can download the Fiddler application from here. A Jing video demonstrating the issue may also help us to better understand what is happening. Thank you for providing the information we require to advise you best.
the Telerik team
Test Studio Trainings
I was able to get the extracted value in the gird and then get the InnerText of the label; then compared it using contains using coded step.