Functionize allows you to create reusable elements, or Page Objects, so you don’t have to write out the same steps again and again. Write the steps for a login (or a similar repeated task) once and then use that same set of steps in hundreds of test cases, by simply stating in the test plan “Use page object ‘login’“.
In Functionize, we have two ways to create page objects. You can create it as a standalone as if it were its own test and you can create it on the fly while writing the steps of your test case. This process will look familiar as page objects are created just like standard steps in a test case. See also Create a New Test Case for further information.
Create a Standalone Page Object
- Click on the Create New Test button and add details for the Page Object.
- Click Next which will open the Test Steps tab.
- Type Create Page Object (or select Create Page Object from the keyword dropdown menu). This notates the start of a page object to be created.
- Then set the name of the element using quotation marks like "Random" in the example below.
- Enter the steps for the repeated process.
- Type End Page Object (or select End Page Object from the keyword dropdown menu). This notates the end of the page object being created.
- Click Submit.
- Once submitted, it will enter the NLP Modeling Queue after which it will be available for use in other tests.
Create a Page Object During Test Case Creation
You can also make a Page Object while you create your test case. This functions the same as a standalone page object, but is initially created within the steps of your existing test case.
- Add test steps leading up to your page object.
- Type Create Page Object (or select Create Page Object from the keyword dropdown menu). This notates the start of a page object to be created.
- Then set the name of the element using quotation marks like "Random" in the example below.
- Add all repeatable steps within the page object.
- Type End Page Object (or select End Page Object from the keyword dropdown menu). This notates the end of the page object being created.
- Continue writing your test steps as normal for the test case.
Using a Page Object/Reusable Element
Once a page object is created in one of the two ways described above, it is saved and ready to use in any test case. During the test step writing process, type the keyword Use Page Object and select the one for your test from the list of available Page Objects.
Editing a Page Object
Editing a page object is done within the test case steps. Simply edit the test case steps for the page object. See also: How to Edit a Page Object.
Best Practices for Page Objects
Below are keywords currently used for Page Objects. These should be used when writing test cases for NLP processing.
Keyword |
Use of Keyword |
Example of Keyword Usage |
Create Page Object |
This is to notate the start of a page object to be created and used in this test case. |
Step 1: Create Page Object <name> Step 2: Click login and enter <email> Step 3: Enter <password> Step 4: Click submit End Page Object |
End Page Object |
To notate the end of a page object that is being created. |
Step 1: Create Page Object <name> Step 2: Click login and enter <email> Step 3: Enter <password> Step 4: Click submit End Page Object |
Use Page Object |
This is used for existing or previously created page objects |
“Use Page Object login w/admin” |
Sample .csv files for creating Page Objects
Best Practice: Add Mobil to cart - use predefined page object.csv
This example shows the use of a preexisting Page Object that was predefined as it's own separate test case.
Best Practice: Define Login and Logout Page Objects.csv
This example shows 2-page objects being created within a single test case.
Best Practice: Add Mobil to cart AND define Page Object INLINE.csv
This example shows a page object being defined inline within the context of the test case.
Learn more about Page Objects in this webinar.