Procedure Implementation
In this section, a basic test Procedure will be implemented, responsible for executing the scenario logic previously defined in the successful login Script. The Procedure is the point where the system behavior is effectively exercised. It executes actions, interacts with the application, and performs validations, always within the context of a Script.
In Probato, a Procedure can be implemented in two ways:
- As a method inside the Script
- As a reusable dedicated class
Implementing a Procedure as a method in the Script
This approach is recommended for simple scenarios, with short logic and no need for reuse.
- Open the class
UC01TC01_DoLoginSuccessfully.java. - Add a method annotated with
@Procedure.
In this model, the method annotated with @Procedure represents the main execution of the scenario.
Separating precondition and postcondition
If it is necessary to distinguish scenario stages, specific methods can be defined.
This separation improves readability, traceability, and failure diagnostics.
Implementing a Procedure as a dedicated class
This approach is recommended when the logic:
- Is more complex
- Needs to be reused
-
Should be isolated from the Script
-
Create the class
DoLoginSuccessfullyProcedure.java.
| DoLoginSuccessfullyProcedure.java | |
|---|---|
The @Run annotation indicates the entry point for the Procedure execution.
Associating the Procedure with the Script
After creating the Procedure class, it must be associated with the Script.
In this model, the Script remains declarative, while the logic is encapsulated in the Procedure.
Executing at this stage
When executing the project at this point:
- Probato will locate the associated Procedure
- Execute the annotated methods correctly
- Display the outputs in the console
This confirms that the Script → Procedure flow is working.
Final checklist
Before proceeding, make sure that:
- ✅ The Procedure was implemented correctly.
- ✅ The Script references the Procedure.
- ✅ The project compiles without errors.
- ✅ The precondition, execution, and postcondition methods are executed.
With the Procedure implemented, the next step will be to create the Page Objects, responsible for encapsulating interactions with the user interface.
➡️ Continue to Page Object Implementation.