Overview
TheGeneracionReporteSteps class contains step definition methods that implement the behavioral steps defined in feature files. Each method is annotated with Spanish Gherkin keywords (@Dado, @Cuando, @Entonces) and uses Cucumber expressions to match feature file steps.
Class Definition
Step Definition Methods
el_usuario_ingresa_a_la_web_de_chronos
Annotation:
@Dado("el usuario ingresa a la web de Chronos")Implements the precondition step that navigates the user to the Chronos web application.Method Signature
Parameters
This step takes no parameters.Description
This step definition handles the initial setup for report generation tests. It represents the “Given” precondition where the user navigates to the Chronos web application before performing any actions.Current Implementation
The current implementation is a placeholder that prints to console. In a complete implementation, this method would:
- Initialize the WebDriver instance
- Navigate to the Chronos application URL
- Verify the page loaded successfully
- Perform any necessary authentication
Usage in Feature Files
ingrese_los_datos_del_reporte_para_la_compañia_segun_la_fecha
Annotation:
@Cuando("ingrese los datos del reporte {string} para la compañia {string} segun la fecha {string}")Implements the action step that enters report parameters into the Chronos application.Method Signature
Parameters
The report identifier or code to be generated.Example:
"417"This value is extracted from the feature file’s Examples table and passed to the method via Cucumber’s {string} expression.The company name for which the report should be generated.Example:
"compañia 1"This parameter identifies the business entity or client whose data will be included in the report.The date for the report in ISO 8601 format (YYYY-MM-DD).Example:
"2026-02-01"Specifies the reporting period or effective date for the generated report.Description
This step definition handles the main action of entering report generation parameters into the Chronos web application. It receives three parameterized values from the feature file and uses them to fill in the report form.Current Implementation
The current implementation is a placeholder that prints parameters to console. In a complete implementation, this method would:
- Locate form fields on the Chronos application
- Enter the report ID in the appropriate field
- Select or enter the company name
- Input the report date
- Submit the form or click the generate button
Usage in Feature Files
se_genera_el_reporte_de_manera_exitosa
Annotation:
@Entonces("se genera el reporte {string} de manera exitosa")Implements the verification step that confirms successful report generation.Method Signature
Parameters
The report identifier that should have been successfully generated.Example:
"417"This value is used to verify that the correct report was created.Description
This step definition validates that the report generation process completed successfully. It represents the “Then” assertion that verifies the expected outcome of the test scenario.Current Implementation
The current implementation is a placeholder that prints to console. In a complete implementation, this method would:
- Wait for the report generation to complete
- Verify a success message is displayed
- Check that the report file exists or is downloadable
- Validate the report ID matches the expected value
- Assert that no error messages are present
Usage in Feature Files
Cucumber Expressions
All step definitions use Cucumber expressions with{string} parameter types:
Understanding {string} Parameters
Understanding {string} Parameters
The Step Definition:Cucumber automatically extracts
{string} expression in Cucumber annotations matches text enclosed in double quotes in feature files.Feature File:"417", "compañia 1", and "2026-02-01" and passes them as method parameters.Complete Example Flow
Here’s how a feature file scenario maps to step definition methods:Feature File
Execution Flow
- Step 1:
el_usuario_ingresa_a_la_web_de_chronos()is called - Step 2:
ingrese_los_datos_del_reporte_para_la_compañia_segun_la_fecha("417", "compañia 1", "2026-02-01")is called - Step 3:
se_genera_el_reporte_de_manera_exitosa("417")is called
Spanish Gherkin Keywords
This framework uses Spanish language Gherkin keywords:Equivalent to
@Given in English. Represents preconditions or setup steps.Equivalent to
@When in English. Represents actions or events.Equivalent to
@Then in English. Represents expected outcomes or assertions.Implementation Guidelines
Best Practices for Step Definitions
Best Practices for Step Definitions
When implementing step definitions:
- Keep steps atomic - Each step should perform one clear action
- Use Page Objects - Interact with UI elements through Page Object Model classes
- Handle waits properly - Use explicit waits for dynamic content
- Add meaningful assertions - Verify expected outcomes thoroughly
- Avoid hardcoding - Use configuration files for URLs and test data
- Implement error handling - Provide clear failure messages
- Follow naming conventions - Use descriptive method names that match the Gherkin text
Package Location
src/test/java/org/btg/practual/stepDefinitions/GeneracionReporteSteps.java
Related Documentation
- CucumberRunner - Test runner configuration
- Test Scenarios - Feature file structure and syntax