web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem trying to run ...
Power Apps
Answered

Problem trying to run ForAll loop in Powerapp Testsuite

(0) ShareShare
ReportReport
Posted on by Microsoft Employee
Functionality we want to achieve:
Instead of creating different multiple test cases we want to use a For Loop to run all of them from a list.
 
Expected results
The test case keeps running and creating the records/entering the field values and clicking on the buttons (new/submit and button1 (used for debugging)) according to the number of items in the FOR-loop list.
 
Problem:
The test case is running properly, without any errors, but not working as expected.
It is not creating more than 1 record but still clicking on the debugger button according to the items in the FOR-loop list.
For example, instead of creating 7 new records it creates only 1 record but shows that the debugger button has been clicked 7 times.
Even the record created is empty with no data entered or selected in it, which means that this part of the test case is not working, in the ForAll loop.
 
Repo steps:
  1. Create a Canvas App form with New/Submit button, text fields/ to enter some data in them.
  2. Add a debugger button to show the count of which iteration the loop ran for (optional)
  3. Create test suite then test case, record a test case of creating and submitting a new record with some fields filled in the form and then submit it.
  4. Create another test case and use a list to initialize it, and then add a ForAll-LOOP to run the number of times according to the list. and perform the actions mentioned above. Then run the test.
  5. For example : 
 
OnTestCaseStart
 ClearCollect( Questions, [ "combined question 1", "combined question 2"
  , "combined question 3", "combined question 4", "combined question 5","combined question 6"  ]);
 
Step in the TestCase
ForAll(
    Questions, 
    Select('NewRecordAddIcon1')& //worked once
    SetProperty('DataCardValue1'.Text, "testingforloop")& //not working at all
    Select('Button1')& //working according to the loop
    Select('SubmitFormButton1') //worked once
)
 
 
Please see attachment for Play Mode result, which says it works fine but actually it's not creating the new records.
 

 

image.png
Categories:
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    & is for boolean logic, you should be separating those functions with a semi-colon

     

    ForAll(
     Questions, 
     Select('NewRecordAddIcon1');
     SetProperty('DataCardValue1'.Text, "testingforloop");
     Select('Button1');
     Select('SubmitFormButton1')
    )

     

    Bear in mind though, that you likely won't get an indication of which row failed during your tests, so it is still advisable to have separate tests

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    you are right we can try replacing the & with semicolon, and that we won't be able to check at which point exactly this flow failed, that's why I added a " Select('Button1') //working according to the loop" for debugging purposes.

     

    I tried your suggestion (separating those functions with a semi-colon) but didn't see any difference in the results. 

    Thanks for the suggestion, I had also tried bringing the buttons outside of containers and making them visible at all time (true) just to see if it can help with the test suite work properly, but still no difference.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I created a for each loop in Power Automate Desktop PAD and that way it worked.

    foeach loop.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard