TDD Framework

Version 0.12.0 (Compatible with OutSystems 11)
Published on 16 Jun by 
5.0
 (1 rating)

TDD Framework

Documentation

Purpose


This component allows you to quickly create a unit test for your Reactive Web or Mobile Applications.

It was originally designed to test library reactive modules.

Similar to the BDD framework, it implements a few blocks which represent a Scenario or Test Case and Steps.


Getting Started


Reference all public items of the TDDFramework Library.

Create a new page

Create a local variable of type TDDTracker to track the current step being executed

Put TDDSteps inside TDDScenario.

Use the TDDAutostart as the last block on your page.



Public Blocks


TDDAutoStart - Automatically start executing all tests on page.

TDDDashboard - A summary displaying the test results of your page.

TDDScenario - Simple scenario with Setup, Steps and Teardown.

TDDScenarioGherkin - GHERKIN scenario with Setup, Given, When, Then and Teardown.

TDDStep - This is the main block where you declare the steps you are taking for your steps. The concept of step is an abstraction. In practice the step will allow you to execute code and then perform an assertion over the result of your code. TDDStep exposes the following:

  • Events:

    • OnStepRun - Implement this event to run your code and perform the assertion. If your code raises an exception be sure to trap it and use the AssertException method. All your subsequent steps on the same scenario will be skipped.

    • OnStepNext - Implement this event to run the next step. Call the ScenarioNextStep method and assign the TDDTracker variable with its results. You can use the same method for all steps.

  • Input Parameters:

    • TDDTracker - Assign a variable to hold the step being executed. On your test page, implement the OnStepNext event and use the ScenarioNextStep method to set this variable and execute the next step.


Public Methods


ScenarioStepNext - Returns a TDDTracker representing the next step to be executed on the TDDScenario List. Remember to update the TDDTracker with the output of this method.

ScenarioStepEnd - Method to be used after the last assertion. It triggers the step evaluation and the move to the next step.

AssertException - Special case to handle exceptions and skip subsequent steps. Use this method on the exception handler of your flow.

AssertFail - Produces an always failed assertion. Useful if you just want to fail on a branch of your code.

AssertFalse - Assert for false on the input condition.

AssertPass - Produces an always Pass assertion. Useful if you just want to pass on a branch of your code.

AssertTrue - Assert for true on the input condition.

AssertValue - Assert if 2 values are the same.


Older Versions


<= 0.11


Getting Started


Reference all public items of the TDDFramework Library.

Create a new page

Create a local variable of type TDDScenario List

Create a local variable of type TDDTracker to track the current step being executed



Public Blocks


The TDD Framework exposes the following blocks:

TDDStep - This is the main block where you declare the steps you are taking for your steps. The concept of step is an abstraction. In practice the step will allow you to execute code and then perform an assertion over the result of your code. TDDStep exposes the following:

  • Events:

    • OnStepRegister - Implement this event to register the step on the step list. Use the method ScenarioStepRegister and assign the output to a local Scenario List. The same method can be used for all steps.

    • OnStepRun - Implement this event to run your code and perform the assertion. If your code raises an exception be sure to trap it and use the AssertException method. All your subsequent steps on the same scenario will be skipped.

    • OnStepUpdate - Implement this method to update the TDDScenario List with the new version of this specific Step. Use the ScenarioUpdateStep method and assign its output to the scenario local list. You can use the same method for all steps.

    • OnStepNext - Implement this event to run the next step. Call the ScenarioNextStep method and assign the TDDTracker variable with its results. You can use the same method for all steps.

  • Input Parameters:

    • TDDTracker - Assign a variable to hold the step being executed. On your test page, implement the OnStepNext event and use the ScenarioNextStep method to set this variable and execute the next step.


TDDScenario - The Scenario represents a test. Add a description and steps to the placeholders. TDDScenario exposes the following:

  • Events:

    • OnScenarioRegister - Implement this event to register the Scenario as a grouping of steps. Use the ScenarioRegister method and assign the output to a local scenario list. You can use the same method for all scenarios.




Public Methods


ScenarioRegister - Registers a Scenario on the TDDScenario List. Remember to update your list with the output of this method.

ScenarioStepRegister - Registers a test on theTDDScenario List. Remember to update your list with the output of this method.

ScenarioStepUpdate - Updates the TDDScenario List with a specific step. Remember to assign the output of this method to your list.

ScenarioStepNext - Returns a TDDTracker representing the next step to be executed on the TDDScenario List. Remember to update the TDDTracker with the output of this method.

ScenarioStepEnd - Method to be used after the last assertion. It triggers the step evaluation and the move to the next step.

AssertException - Special case to handle exceptions and skip subsequent steps. Use this method on the exception handler of your flow.

AssertFail - Produces an always failed assertion. Useful if you just want to fail on a branch of your code.

AssertFalse - Assert for false on the input condition.

AssertPass - Produces an always Pass assertion. Useful if you just want to pass on a branch of your code.

AssertTrue - Assert for true on the input condition.

AssertValue - Assert if 2 values are the same.