Hi,
I couldn't find a good answer for a situation that I'm having here. I'll try to explain:
I have a smart folder that has a data source that uses a specific product (Range 4,9) .
Inside the Smart_Folder1 has some Recording (using the specific ranges). Inside the Smart_Folder1 has the Smart_Folder2 (with other data source) that I want to use to validate a table in a website (specific for each product). However, I want to use different ranges in the Smart_Folder2 according to the current product selected in the Smart_Folder1. (Confusing?).
I found on looping-module-in-a-test-case-t10499.html#p42114 that I can create a code module to to change the range in each iteration. However, the code in that post is outdated. I tried to change myself but without success.
Does anyone know a way to make that (code or through Ranorex.)
Select range according to the current value in the "main" Smart Folder
Select range according to the current value in the "main" Smart Folder
You do not have the required permissions to view the files attached to this post.
Re: Select range according to the current value in the "main" Smart Folder
Hi EdJulio,
Welcome to the Ranorex Forums! The first thing that comes to mind would be to use the Command Line parameters for Selective Test Runs. Look under the "Set a data range in a test container’s data source" in the linked article. It is possible to create a batch file with specific parameters passed to the Test Suite's executable file so that you can dynamically set the selected rows to pull from the data source at runtime. I think this is simpler than trying to code my way out of situations like this, and can be dynamic enough to do all kinds of stuff. I hope this helps!
--Jacob
Welcome to the Ranorex Forums! The first thing that comes to mind would be to use the Command Line parameters for Selective Test Runs. Look under the "Set a data range in a test container’s data source" in the linked article. It is possible to create a batch file with specific parameters passed to the Test Suite's executable file so that you can dynamically set the selected rows to pull from the data source at runtime. I think this is simpler than trying to code my way out of situations like this, and can be dynamic enough to do all kinds of stuff. I hope this helps!
--Jacob
Re: Select range according to the current value in the "main" Smart Folder
Hi,
Here is the updated code reflecting your test:
Simply add the above code in a new code module, placed anywhere inside Search_Product TC (but "before" Validate_Qty_Break_table SF). Of course, change the column name and data ranges according your needs. Hope this helps?
Here is the updated code reflecting your test:
Code: Select all
string curTCName = TestSuite.CurrentTestContainer.Name;
var curTC = TestSuite.Current.GetTestContainer(curTCName);
var setRangeTC = TestSuite.Current.GetTestContainer("Validate_Qty_Break_table");
string rowValue = curTC.DataContext.CurrentRow.Values[curTC.DataContext.Source.Columns["columnName"].Index]; //get value from current data range
if (rowValue == "0")
{
setRangeTC.DataRange.MinRange = 0;
setRangeTC.DataRange.MaxRange = 2;
setRangeTC.DataContext.SetRange(sitesTC.DataRange.MinRange,sitesTC.DataRange.MaxRange); // sets first 3 rows of QtyBreakProdutSearch2 data source
}
else if (rowValue == "3")
{
setRangeTC.DataContext.SetRange(DataRangeSet.Parse("5-7,9")); // sets rows 6-8 and 10
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Select range according to the current value in the "main" Smart Folder
Thanks for all the answer of this post, and sorry for the late reply.
Pavel, I tried through code again but I noticed the CurrentRow is returning null which I think is what causes the "Object reference not set to an instance of an object". I can't find where the problem could be. Any thoughts of what could be?
Pavel, I tried through code again but I noticed the CurrentRow is returning null which I think is what causes the "Object reference not set to an instance of an object". I can't find where the problem could be. Any thoughts of what could be?
You do not have the required permissions to view the files attached to this post.