FIltering Test Data with a specific condition

Best practices, code snippets for common functionality, examples, and guidelines.
tsahoo
Posts: 3
Joined: Sat Jan 09, 2016 10:20 pm

FIltering Test Data with a specific condition

Post by tsahoo » Sun Jan 10, 2016 1:41 am

Hi,

I am using Ranorex out of functionality to load data from excel.

Scenario: I have 4 submodule in my test suite. For one test case.. I need 1 row from the 1st module, 5 rows from 2nd module, 3 rows from 3rd module etc.

Currently I am using "foreach" loop to filter the data based on some condition (eg: client id). For 100-150 records, it's working fine. But recently I got to know that business team is planning to use and there are more than 5000 records for each module. I tried with 1000 records and noticed that it's taking lot of time to the filter the data.

Is there any easy fix for this problem. I have heard about LINQ but does not have enough knowledge to write code. I don't want to change my complete framework for loading data.

Thanks in advance for all the help and suggestion.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: FIltering Test Data with a specific condition

Post by krstcs » Mon Jan 11, 2016 2:28 pm

Can you show us the code you are using? Without that it will be almost impossible to really give you a good answer.

As for LINQ, it won't really be a whole lot faster dealing with that many records.

From the info you have given, and without the code, it appears you have 2 options:

1. Restructure you data so that it fits your test cases better. This might make the data easier to filter.

2. Move the data to an actual database (SQL Server). DBs are designed for specifically what you are trying to do. They sort, filter, and match generic records better than any other tool. In other words, use the right tool for the job.
Shortcuts usually aren't...

tsahoo
Posts: 3
Joined: Sat Jan 09, 2016 10:20 pm

Re: FIltering Test Data with a specific condition

Post by tsahoo » Mon Jan 11, 2016 7:52 pm

Here is the code I use for filtering:

DataSources.Get("FilteredData").Rows.Clear();

foreach (Ranorex.Core.Data.Row row in DataSources.Get("AllData").Rows)
{
if (row.Values[0] == TC)
{
DataSources.Get("FilteredData").Rows.Add(row);
}
}
DataSources.Get("FilteredData").Store();

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: FIltering Test Data with a specific condition

Post by Support Team » Thu Jan 14, 2016 3:26 pm

Hi tsahoo,

May I ask you if you could also show us your Test Suite structure. I'd like to see when exactly you are executing this code.

Basically, I'd also agree with krstcs that SQL Data Connectors would be the better approach for your intention.

Please find more information about the SQL Data Connector in our User Guide.

Regards,
Markus (S)
.
Image