0

I want to make an automated order and payment. There's a list of Order and a list of Payment, and I want to use all of the payment for all the order.

Order List :

  1. Order A
  2. Order B . .

Payment list :

  1. Payment A
  2. Payment B . .

I try using interleave controller for 1 order to use all payment. But it's resulting for me to copy paste the interleave into the amount of order that I have and it's difficult to maintain if I have many order.

Order A
- Add product
- Interleave controller
-- Payment A
-- Payment B
Order B
- Add product
- Interleave controller
-- Payment A
-- Payment B

So I change to putting interleave for the order and the payment.

Interleave Controller (Order)
- Order A
- Order B
.
.
Interleave Controller (Payment)
- Payment A
- Payment B
.
.

But the result is

Order A
Payment A
Order B
Payment B

What I want is the order can get all of the payment without duplicate the payment. And have the result to be:

Order A
Payment A
Order A
Payment B
Order B 
Payment A
Order B
Payment B
.
.
and so on
akaiki
  • 1
  • Instead of Interleave Controller, ForEach Controller would be better to choose for your scenario to achieve the result you want. – Satish Shihani May 09 '23 at 09:27

1 Answers1

0

Take a look at ForEach Controller, in the majority of cases it's better applicable for the kind of loop you're trying to achieve.

If you additionally want to avoid code duplication you can also consider Test Fragments and Module Controllers.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133