Using Page Objects in Test Cases

A Page Object is a reusable set of actions that represent a page or component of your application under test. Page Objects make your tests easier to maintain and extend by allowing you to reuse sequences of actions across multiple test cases.

You can create Page Objects in two ways:

  • With Architect while recording a new test.
  • From an Instruction within an existing test case.

Once created, Page Objects are stored under the Page Objects tab on the Test Listing page, where they can be reused in future tests.

Requirements

To create a Page Object from an existing test case, the test must already include Instructions, which are groups of actions executed in sequence. Instructions can be added from the Test Details page or the Slider View.

Creating a Page Object from an Existing Test Case

  1. Open a Test Case: Navigate to the desired test case.
  2. Create a Page Object: Open the Settings menu and select Create Page Object.
  3. Select the Instruction: Choose the Instruction you want to convert into a Page Object and click Update.
  4. Name and Describe the Page Object: Provide a meaningful name and description, then click Submit.
  5. Confirmation: The Instruction is now a Page Object, visually denoted by a dark border in the UI.

Adding an Existing Page Object with Architect

Once a Page Object has been created, it can be reused during test creation in Architect.

  1. Open Architect: Launch Architect for your application under test.
  2. Access Advanced Action: Click the + button to open Architect Advanced Actions.
  3. Select a Page Object: Under the Control section, choose Page Objects.
  4. Choose from the List: Select a Page Object from the available list.
  5. Review the Actions: The related set of test actions will display for review.
  6. Add the Page Object: Click Add to include it in your test. The Page Object will now appear in your action list, marked with a green PO tag.
  7. Continue Recording: Proceed with recording additional steps as usual.
  8. Save the Test: When finished, save and name the test. The test will now include the selected Page Object.

Note: The only Test Type available in this workflow will be Test Case, since Functionize does not currently allow nested Page Objects.

Adding an Existing Page Object with Import

Once a Page Object has been created, it can be reused during test editing using Import.

  1. Click Import: On the test details page, click the Import button.
  2. Select Import Type: On the Import Actions popup modal, choose Page Objects as the Import Type.
  3. Choose Page Object(s): Open the Select Page Objects dropdown and select the desired Page Object(s) to import.
  4. Place Page Object(s): Drag and drop the selected Page Object(s) from the Imported Actions into the current test where required.
  5. Save the test case: Click Save to save the test case.
  6. Modify the parameter(s): Add parameters to modify and click save, or click cancel to skip parameter modification.

Adding an Existing Page Object with Quick Add

Once a Page Object has been created, it can be reused during test editing with Quick Add.

  1. Click Quick Add: In the desired test case location, click on the plus icon between test steps to open the Quick Add menu.
  2. Select Page Object type: Click on Page Object in the Quick Add menu.
  3. Choose Page Object: Open the Page Object List dropdown and select the desired Page Object.
  4. Add Page Object: Click on Add Page Object to add the Page Object to the test case.

Modify the parameter(s): Add parameters to modify and click save, or click cancel to skip parameter modification.