Test Steps
Test steps are created using the TrganStep class within a TrganTest context. Each step represents a distinct action or checkpoint in the test flow and serves as a structured unit for logging execution status. The TrganStep object exposes intuitive methods—Pass(), Fail(), Skip(), and Log()—to record outcomes and annotate progress. This approach ensures consistent reporting, improves traceability, and enhances readability across test suites.
Creating a Trgan Step
You can create a step using the CreateStep method from TrganTest obj, which initializes the step instance and allows you to update its details later. Alternatively, use AddStep to create and log the step with all required data in a single call.
1 2 3 4 5 6 7 8 |
|
1 2 3 4 |
|
AddStep() provides a streamlined way to create and log a TrganStep in a single call, eliminating the need for separate instantiation and status assignment. This method is particularly effective for concise test flows and supports both generic and BDD-style steps, allowing you to pass a GherkinKeyword for semantic clarity.
1 2 3 4 5 6 7 8 9 |
|
- if it is the first step under a TrganTest, the duration spans from the test’s creation time to the current step’s end time.
- otherwise, it spans from the previous step’s end time to the current one.
Info
If a TrganTest contains multiple steps with varying statuses, its overall status will reflect the highest severity among them.