Forum Discussion

MMZ's avatar
MMZ
Occasional Contributor
3 days ago

TestComplete Keyword Order Execution

Please confirm: Is keyword testing required to follow a strict sequential order, or can we execute keywords non-sequentially? For context, our webpage has fields distributed across various containers. We want to know if TestComplete supports jumping between sections (e.g., from top to bottom, then center, then back to top) during testing.

4 Replies

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    If I understand your question correctly, you are asking whether TestComplete must execute UI interactions in a strict sequential (top-to-bottom) order, or whether it is supported to jump between different sections of a webpage (top, bottom, center, and back again) during a single test run without causing execution issues.

    TestComplete does not require to follow the visual or recording order of the page. Steps execute strictly in the order they appear in the test, regardless of where the target objects are located on the page. However, when interacting with web elements that are outside the current viewport, it's wise to explicitly scroll the page to make the element visible on screen before performing any action.

    To avoid unstable behavior or unexpected test errors:

    • Always add a Scroll Page or Scroll to Object step before interacting with fields that are not currently visible.
    • Do not rely on the initial recording order to handle scrolling automatically.

    Important note for dynamic or lazy-loaded pages:
    If your application loads elements only when the page is scrolled, you should:

    1. Scroll all the way down (or until the required section is loaded),
    2. Then explicitly scroll to the specific field before interacting with it.

    Without these steps, TestComplete may fail to find the object, interact with the wrong element, which can appear as “confused” test behavior.

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    In TestComplete, Keyword Tests define the steps or actions to perform, while the Execution Plan controls the order in which those Keyword Tests are run. Keyword Tests do not have to follow a fixed sequence and can be executed in any order through the Execution Plan, regardless of the page layout or when the tests were created. Only the steps inside an individual Keyword Test run sequentially, from top to bottom.

     

    • MMZ's avatar
      MMZ
      Occasional Contributor

      I recorded that the keyword testing starts from the top then the bottom then the center and they are executed. But the test gets completely confused exit from its execution.

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        If it's not working based on the actions you recorded, then it's most likely due to duplicate Name Mapping entries, which can cause playback to stop midway.

        If this is your first time using TestComplete, I strongly suggest reading up on Object Identification, as it's one of the most important concepts in TestComplete. Once you understand the basics, things start to come together.