Functions
DevAssure empowers you to create efficient and maintainable tests by allowing you to create reusable functions. This feature allows you to break down your tests into reusable functions, promoting code reuse and streamlining the test creation process.
Creating Page Functions
Page functions are a type of function created by extracting a sequence of steps from a recorded test. They are particularly useful when you have a common set of actions you need to perform in multiple tests.
To create page function:
-
Record your test and perform the actions you want to convert into a page function as usual while recording.
-
After recording, navigate to the test steps and select the steps you want to include in the page function.
-
Select Extract selected steps as Page Function from the context menu. Devassure will prompt you to name your new page function.
-
Choose a clear and descriptive name that reflects the function's purpose.
-
Click “OK”. a new page function containing the extracted steps is created.
You can now use your newly created page function in any of your tests. To do this, simply reference the page function name in your test steps.
Example:
Imagine a common login functionality used across various tests. By modularizing the login steps, you only need to define them once. Whenever a test requires login, you can import and utilize the pre-defined modular step, ensuring consistency and reducing redundancy.