Let’s Get Certified
Module 08 / 10 · Power Automate

Test the trigger and both approval branches

Trace a cloud flow from event to action and check a desktop flow against changing window or form state.

Test the trigger and both approval branches

Work through the decision

A generated cloud flow sends an approval email on every change to a request. One request generates six emails and a denied request creates a purchase order. What would a small test expose?

Check your reasoning

Specify the transition that makes a request eligible, carry its ID through the actions and branch on the approval result. Include a repeated delivery in the test. For a desktop step, verify the expected window, UI element and final state. A generated flow is a draft that requires inspection and replay.

Watch the source lesson at 38:41

Compare the choices

Trigger condition
Narrow the events that should start an eligible run and consider transitions that might retrigger it.
Connector action
Invoke an operation exposed by a service using the configured connection and supplied inputs.
Outcome condition
Branch on the returned decision so that rejected work follows its own path.
Stable operation key
Use a durable identity for the business operation when recording completion so redelivery can be recognized.
Desktop element selector
Identify the target UI element and expected window in the desktop flow, then test against realistic state changes.
Run history
Inspect actual inputs, outputs, branch decisions and failing steps, taking care with sensitive fields.

Test the decision

Run request R41 through Submitted, In review and Rejected. Its trace should contain one approval and no purchase order. Retry the original submission with the same event identity. If it produces another order, add an operation-level duplicate check before the write.

In Power Automate, start a test run with a sample request and then inspect the trigger payload. Expand the approval action and condition in run history. Verify the input ID, outcome and the skipped branch. For the desktop part, inspect the target window and selector in the designer and run on representative test data before enabling unattended operation.

Practice the guide skills

  1. Trace a cloud flow’s connector trigger, inputs, action outputs and connection identity in a test run. Watch 38:41
  2. Use a natural-language request to draft a cloud flow, refine its condition and inspect both approved and denied results. Watch 40:01
  3. Describe a desktop task to the AI authoring experience, verify generated actions and selectors, and test a missing-window case. Watch 40:58

Official objectives for this lesson

Lab · Replay an approval flow

Predict which events cause a purchase order. This offline Python model uses a request ID as the purchase operation key and records orders only after approval. Try a duplicate approval and a reviewer denial.

events = [("R8", "Submitted"), ("R9", "Rejected"),
          ("R8", "Approved"), ("R8", "Approved"), ("R10", "Approved")]
orders = {}
for request, outcome in events:
    if outcome != "Approved":
        action = "no order"
    elif request in orders:
        action = "already processed"
    else:
        orders[request] = "PO-" + request
        action = orders[request]
    print(request, outcome, action)
print("orders:", len(orders))
Check the result
R8 Submitted no order
R9 Rejected no order
R8 Approved PO-R8
R8 Approved already processed
R10 Approved PO-R10
orders: 2

Add another approval for R10 and predict the final count. A real flow needs a durable key and an atomic create or downstream idempotency guarantee across concurrent runs. Use run history to check each branch. The local dictionary models sequential delivery.

Related lesson · Design a parameterized orchestration

Knowledge check

Test the trigger and both approval branches quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Test the trigger and both approval branches