ATF for client scripts dropdown choice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2025 02:02 AM
HI,
i have a choice box which will be loaded onchange of of "Project_Type" as "Existing" i will be sending a Rest Call using scripts include and i will add Options to the "project_name", how can i test this in ATF
In ATF
Im using Set variable (SP) - when i select the Project_name i dont get the dropdowns (as it is dynamic and set to on change)
how can i automatically test this and set value for the "project_name" variable ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2025 11:17 AM
Hi Pramoth,
Great question, Testing dynamic dropdowns with ATF can be tricky since they’re populated by client scripts (onchange events) and often rely on REST calls or Script Includes. Here are some reliable approaches you can use:
1. Use a Server Script step in ATF
Create a Run Server Side Script step to simulate the REST call logic and directly insert predefined choice values into the project_name field. This way your test doesn’t depend on the actual external call.
2. Mock the Script Include / REST response
If your dropdown is populated by a Script Include calling REST, you can mock or override it during ATF to return sample test data. This makes your test stable and independent of external systems.
3. Directly set field values
If you just need to proceed with the test, you can use ATF to set the project_name field value directly (or via a server script). Just make sure ACLs don’t block test steps from updating the field.
4. Trigger the onchange logic properly
In your ATF test, always set the Project_Type field first (to “Existing”) before touching project_name. This ensures any dependent client scripts or UI policies get executed in test context.
(Optional) Some ATF versions also have Validate Choice / Validate Choice List steps that let you confirm the available dropdown values. If your version supports it, that’s a clean way to verify the populated options.
The key idea: ATF can’t always “wait” for client-side onchange events to run like a human would, so you need to simulate or mock that behavior on the server side.
Hope this clears it up!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it helpful & accept the solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
