Data-driven Test: 1 header with multiple item lines

Best practices, code snippets for common functionality, examples, and guidelines.
leo.phan
Posts: 3
Joined: Fri Apr 17, 2020 2:37 pm

Data-driven Test: 1 header with multiple item lines

Post by leo.phan » Fri Apr 17, 2020 3:50 pm

Hi everyone,

I have a question about how to run a data-driven test in the below case. Can you take a look and recommend how can I do it?
I want to create multiple Sales Orders with an optional number of line items.
For example, 2 Sales Orders with header and Item like this
***Header:
Number txtSoldToParty txtShipToParty txtPONumber
1 1000000 1000000 Test001
2 1000000 1000000 Test002

***Item:
Number txtMaterial txtOrderQuantity txtUnit
1 7641 1 CS
1 228.911 1 CS
1 1022.911 1 CS
2 7641 1 CS
2 228.911 1 CS

The UI to configure like the below image
Image
My current Test Suite:
Image

How can I set up the test scripts to solve that problem? Could you guys please give me some recommendations?

Many thanks
Last edited by leo.phan on Tue Apr 21, 2020 11:51 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Data-driven Test: 1 header with multiple item lines

Post by odklizec » Mon Apr 20, 2020 8:27 am

Hi,

I'm afraid, there are no images displayed in your post. So we have no clue, what your current configuration looks like and therefore, it's hard to understand what exactly you want to achieve? Please upload the images again. Thanks.
Pavel Kudrys
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

leo.phan
Posts: 3
Joined: Fri Apr 17, 2020 2:37 pm

Re: Data-driven Test: 1 header with multiple item lines

Post by leo.phan » Tue Apr 21, 2020 11:52 am

Thank you for your reply.
I've updated the images. Please help me to take a look and give me some recommendations!
Many thanks.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Data-driven Test: 1 header with multiple item lines

Post by odklizec » Tue Apr 21, 2020 12:15 pm

Hi,

The easiest (UI) way to achieve what you want, is to create a copy of Input_Item smart folder. Then in first Input_Item, limit data range to just 1-3 rows and add a condition, that this smart folder should run only in case the txtPONumber is equal to "Test001". Then change the data range of second smart folder to 4-5 and add condition that it should run only if txtPONumber is equal to "Test002". Now if you run the test, the first iteration of Create_Sales_Order should run the first instance of Input_Item SF, while the second iteration of Create_Sales_Order, should run second instance of Input_Item. That's it ;)
Pavel Kudrys
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

leo.phan
Posts: 3
Joined: Fri Apr 17, 2020 2:37 pm

Re: Data-driven Test: 1 header with multiple item lines

Post by leo.phan » Mon Apr 27, 2020 9:20 am

odklizec wrote:
Tue Apr 21, 2020 12:15 pm
Hi,

The easiest (UI) way to achieve what you want, is to create a copy of Input_Item smart folder. Then in first Input_Item, limit data range to just 1-3 rows and add a condition, that this smart folder should run only in case the txtPONumber is equal to "Test001". Then change the data range of second smart folder to 4-5 and add condition that it should run only if txtPONumber is equal to "Test002". Now if you run the test, the first iteration of Create_Sales_Order should run the first instance of Input_Item SF, while the second iteration of Create_Sales_Order, should run second instance of Input_Item. That's it ;)
Hi odklizec ,

Thank you for your recommendation. I just tried to create a test suite like the way you share. However, it did not work automatically if users change the data, the number of item lines. In that case, we must change the data range and the condition before running the test.

I came up with a new idea to solve that problem. I designed the excel file that when users create a new record for header, they must create a new sheet of Item Lines for that header record. With this way, we don't need to configure the data range for each header.
Image

Anyway, thank you so much for your recommendation.