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

Data driven find row -can only bind one field

4 Answers 165 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
peter
Top achievements
Rank 1
peter asked on 24 May 2019, 02:36 PM
By going over the docs and some videos, I've managed to write a test that finds a table row by name (rather than table position) and check that data in another column is as expected. However, it doesn't look great in Test studio because it involves editing the find logic and therefore to look at, you wouldn't know what its doing unless you inspect the elements. It's also a bit laborious to do again and again for different test cases. -Screenshot attached.

SO, I decided the thing to do was to data bind it.
However, its seems that data bind only lets me bind to the find expression, I need that bound and also a binding to say what the expected result in column B is.

In other words, my data file is like this:
NAME         STATUS
Centiro        Passed
Bob smith    Passed
Alan J          Failed

Currently the check for 'Passed', 'Failed' is a part of the element and I can't bind it. -Screenshot attached.

Do I need to code this instead?
Note: most videos on this topic talk of having an edit button or something, I don't have buttons, just a table of data.

4 Answers, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 27 May 2019, 08:26 AM
Hello Peter,

I analyzed the find expression that you have created and the test scenario from the attached screenshots. I see that you are getting a table row, which contains specific text "Centiro" and you have data driven that text in the find expression. You can remove the other filter, that checks for "Passed" value and the find expression should return a combined string of the values from all cells in the specified row.

To check for the "Status" in the next cell, you need to bind it from the Properties pane -> Bindings for step 4 and keep the CompareType as Contains. Test Studio will again check the above mentioned string for the text content.

The chained find expression works best with hierarchical controls such as tree view. That said, it can be utilized in a grid, but the best approach in my experience is to use a coded step. Please check the sample code that iterates through all cells in a grid. Once you find a specific cell, you can get the parent row element and verify the value in another cell either by iterating the row, or specifying the exact cell by index. You can also use external or local data to bind to the coded step.

Currently, you can only data driven one attribute from the find logic. We have created a public feedback item to bind multiple attributes at the same time. You can vote for that item to increase the customer value and we will evaluate it for our next releases.

I hope that the above details will help you automate your scenario. Please do not hesitate to contact us, if you need further assistance.

Regards,
Plamen Mitrev
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
peter
Top achievements
Rank 1
answered on 29 May 2019, 03:59 PM
Thanks Plamen,
I managed to get it working with code, and I also managed to data bind it.
It works well but one slight problem - when 1of 3 iterations fail, the test seems to report as passed, even though the log says failed.
Why is this?
screenshot and code attached
0
peter
Top achievements
Rank 1
answered on 29 May 2019, 04:39 PM

posted wrong code. Here's the code:

 

    public class codedGridVerify : BaseWebAiiTest
    {
        #region [ Dynamic Pages Reference ]

        private Pages _pages;

        /// <summary>
        /// Gets the Pages object that has references
        /// to all the elements, frames or regions
        /// in this project.
        /// </summary>
        public Pages Pages
        {
            get
            {
                if (_pages == null)
                {
                    _pages = new Pages(Manager.Current);
                }
                return _pages;
            }
        }

        #endregion
        // Add your test methods here...
        [CodedStep(@"New Coded Step")]
        public void codedGridVerify_CodedStep()
        {
//**********************************************************
//Verify Centiro passed*************************************
//**********************************************************            
HtmlTableRow containerRow=null;
//Loop all cells
foreach (HtmlTableRow r in Pages.PipelineHistoryUPSTescom.TablePipeline.AllRows)
    {
    foreach(HtmlTableCell c in r.Cells)
        {
        if (c.TextContent.Equals(Data["INPUT A"].ToString()))
            {containerRow = c.Parent<HtmlTableRow>();}
    }
}
//Check the expected status
if (containerRow != null)
    {Assert.AreEqual(containerRow.Cells[5].TextContent, Data["INPUT B"].ToString());}
//**********************************************************
//**********************************************************
        }
    
    }

 

0
Plamen Mitrev
Telerik team
answered on 31 May 2019, 06:53 AM
Hello Peter,

Your code iterates successfully throughout all cell in the table and works great for this scenario.

The result from your shared screenshot is from the first iteration from this quick execution. You can view the results from the other iterations by changing them in the dropdown (see attachment).

When you use data driven testing in a Test List, the results from all iterations are summarized in the Test Results pane. You can drill down to find the exact step, which failed and check the step failure details.

I hope that the above details will help you analyze the results and adjust the test. Please do not hesitate to contact us again.

Regards,
Plamen Mitrev
Progress Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
peter
Top achievements
Rank 1
Answers by
Plamen Mitrev
Telerik team
peter
Top achievements
Rank 1
Share this question
or