Page 1 of 1

Validation

Posted: Thu Jun 21, 2012 8:15 am
by ThN
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

Re: Validation

Posted: Thu Jun 21, 2012 10:16 am
by Support Team
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

Re: Validation

Posted: Thu Jun 21, 2012 12:38 pm
by ThN
Hi,
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));
        	}
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

Re: Validation

Posted: Thu Jun 21, 2012 1:12 pm
by Support Team
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:
Validate.IsTrue(_ExpectedListOfModels.Contains(item.Cells[0].Text), "Some Text", false);
Regards,
Tobias
Ranorex Team

Re: Validation

Posted: Fri Jun 22, 2012 9:41 am
by ThN
Thanks,

Kind regards,

ThN