To use Page Objects in Functionize, you can either record them through Architect or create them manually from the Test Detail page.
Recording Page Objects through Architect
To record a Page Object through Architect, follow these steps:
- Open Architect and create a new test case.
- Click the “Record” button.
- Navigate to the page that you want to create a Page Object for.
- Perform the actions that you want to record.
- Click the “Stop Recording” button.
- Enter a name for the Page Object and click “Save”.
Creating Page Objects manually from the Test Detail page
To create a Page Object manually from the Test Detail page, follow these steps:
- Open the Test Detail page for the test case that you want to create a Page Object for.
- Click the “Add Page Object” button.
- Enter a name for the Page Object and click “Create”.
- On the Page Object page, click the “Add Action” button.
- Select the action that you want to add to the Page Object and click “Add”.
- Repeat steps 4 and 5 until you have added all of the actions that you want to include in the Page Object.
- Click the “Save” button.
Once you have created a Page Object, you can use it in your test cases by simply dragging and dropping it onto the test case canvas. You can also use Page Objects in loops and conditional statements.
Benefits of using Page Objects
There are several benefits to using Page Objects, including:
- Reusability:Â Page Objects can be reused in multiple test cases, which can save you time and effort.
- Maintainability:Â Page Objects are easier to maintain than test cases, as they are more modular and reusable.
- Readability:Â Page Objects make test cases more readable and easier to understand.
Overall, Page Objects are a powerful tool that can help you to write more efficient, reusable, and maintainable test cases.
To use Page Objects in Functionize, you can either record them through Architect or create them manually from the Test Detail page.
Recording Page Objects through Architect
To record a Page Object through Architect, follow these steps:
- Open Architect and create a new test case.
- Click the “Record” button.
- Navigate to the page that you want to create a Page Object for.
- Perform the actions that you want to record.
- Click the “Stop Recording” button.
- Enter a name for the Page Object and click “Save”.
Creating Page Objects manually from the Test Detail page
To create a Page Object manually from the Test Detail page, follow these steps:
- Open the Test Detail page for the test case that you want to create a Page Object for.
- Click the “Add Page Object” button.
- Enter a name for the Page Object and click “Create”.
- On the Page Object page, click the “Add Action” button.
- Select the action that you want to add to the Page Object and click “Add”.
- Repeat steps 4 and 5 until you have added all of the actions that you want to include in the Page Object.
- Click the “Save” button.
Using Page Objects in your test cases
Once you have created a Page Object, you can use it in your test cases by simply dragging and dropping it onto the test case canvas. You can also use Page Objects in loops and conditional statements.
For example, the following test case uses a Page Object to log in to a website:
# Create a new test case.
test_case = fze.testcase("Login to Website")
# Create a Page Object for the login page.
login_page = fze.page_object("LoginPage")
# Open the login page.
login_page.open()
# Enter the username and password.
login_page.enter_username("username")
login_page.enter_password("password")
# Click the login button.
login_page.click_login_button()
# Verify that the user is logged in.
fze.action("VerifyUserLoggedIn").execute()
Benefits of using Page Objects
There are several benefits to using Page Objects, including:
- Reusability:Â Page Objects can be reused in multiple test cases, which can save you time and effort.
- Maintainability:Â Page Objects are easier to maintain than test cases, as they are more modular and reusable.
- Readability:Â Page Objects make test cases more readable and easier to understand.
- Encapsulation:Â Page Objects encapsulate the logic for interacting with a particular page in a web application. This makes your test cases more modular and reusable.
- Reduced code duplication:Â Page Objects can help you to reduce code duplication in your test cases. This makes your test cases easier to maintain and update.
Overall, Page Objects are a powerful tool that can help you to write more efficient, reusable, maintainable, and readable test cases.