Hello,
I am testing a Windows form applciation. It containse a List Box. The test is to check the proper loading of the List Box. I loop through each item of list box to ensure the proper expected item. The problem here is that if the first item fails to validate the test ends. But in the previous version of Ranorex it was displaying the validation results of all the item. Here as the test stops at the first item it failed. I need test to proceed n display the results for rest of the items. Can anyone suggest me with the solution so the I can see exactly which item is not matching with the expected.
Thanks
ThN
Validation
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Validation
Hi,
can you please provide us some more information about the way you are going to validate the list items?
Are you looping over the items using user code, or do you use the data driven approach?
If you are performing your validation via user code, can you provide us the code?
Regards,
Tobias
Ranorex Team
can you please provide us some more information about the way you are going to validate the list items?
Are you looping over the items using user code, or do you use the data driven approach?
If you are performing your validation via user code, can you provide us the code?
Regards,
Tobias
Ranorex Team
Re: Validation
Hi,
Thanks for the reply, Here is my code
In the above code, ExpectedListOfModels is a List<string>. As I am beginner of Ranorex I haven't explored Data driven approach yet. Here I use imlpementation of ITestModule and create my test in the method Run().
Kind regards
ThN
Thanks for the reply, Here is my code
Code: Select all
Table table = "/form[@controlname='GraphicalModelConnectionDemoForm']/container/container[@controlname='panel2']/container/element/container/container/container/container/container[@controlname='panel1']/element/table[@controltypename='NListView']";
// Here I check that all the expecte data is loaded
Validate.AreEqual(table .Rows.Count, _ExpectedListOfModels.Count);
foreach(Row item in table .Rows)
{
Validate.IsTrue(_ExpectedListOfModels.Contains(item.Cells[0].Text));
}
Kind regards
ThN
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Validation
Hi,
basically you can use an overload of the IsTrue validation where you can specify whether an exception should be thrown or not:
IsTrue(condition,message,exceptionOnFail)
So, the call should look something like this:
Tobias
Ranorex Team
basically you can use an overload of the IsTrue validation where you can specify whether an exception should be thrown or not:
IsTrue(condition,message,exceptionOnFail)
So, the call should look something like this:
Validate.IsTrue(_ExpectedListOfModels.Contains(item.Cells[0].Text), "Some Text", false);Regards,
Tobias
Ranorex Team