Open7

BDDFramework in ODC

Junji WatanabeJunji Watanabe

As of 2023/10/07, four Forge components are related to the BDD Framework in ODC.
All of them are made by OutSystems Experts.
The descriptions on each Forge component say or imply:

  • BDD Framework: This corresponds to BDDFramework in O11. A template for this component is recommended to use with this
  • BDD Framework API: provides a REST API to trigger BDD Framework tests
  • BDDFrameworkTestRunLib: A Library to get BDD Framework test suite URLs and retrieve the results from test screens
  • Template_BDD Framework: Works as a starting point for creating test Apps

BDD Framework is the necessary component. Template_BDD Framework should be used to accelerate test creation.
If we want to run tests automatically, like for CI/CD, we use BDD Framework API and BDDFrameworkTestRunLib.

Junji WatanabeJunji Watanabe

We can install Forge components from the ODC Portal.
On the sidebar, click Forge > All assets.

Junji WatanabeJunji Watanabe

As the first step, let's try using Template_BDD Framework.

  1. Click Create in ODC Studio
  2. Select App and click Continue
  3. Select BDD Framework as a template and click Continue
  4. Enter name and description. then click Create app
  5. Add references to the target Actions
  6. Create a UI Flow as a test suite to hold test cases
  7. Copy a test screen under ScreenTemplates UI Flow according to a type of test case and past it under the UI Flow created, then rename it
Junji WatanabeJunji Watanabe

How to create DataDriven tests using Static Entity

  1. Start from a new App created from the Template for the BDD Framework
  2. Copy a template screen and a template block into UI Flow(s) for tests
  3. Change the block inside the List Pattern of the test Screen to the newly copied Test Scenario Block
  4. Change the definition of TestData Static Entity to hold Input and Outputs for test scenarios
  • Change the name to show a relationship with the test scenario Screen
  • Add an Attribute for Input of the test scenario
  • Add Attributes for Output of the test scenario
  1. Add test data as Records in the Static Entity
  2. Implement test scenario (Screen) following Gherkin Syntax. Use the Aggregate Output Parameter as the source for the Expected Values and Output Parameters of the Action under test as the source for the Obtained Values

Regarding Gherkin and Assert Actions, it is done in the same way as in the OutSystems 11 version of BDDFramework.

Junji WatanabeJunji Watanabe

If we just copy and run a template screen, there should be an error.

This is because of the new feature in the BDD Framework for ODC.

It is explained in the "Security of the screens" section and the "Configure the security of your tests screens:" section in the component's Documentation.

Junji WatanabeJunji Watanabe

BDD Framework has a Secret Setting called AuthenticationSecretToken. The Layouts in the Library require us to pass the AuthToken used to verify if our request is authoritative.

According to this document, secret Settings don't have default values.
https://success.outsystems.com/documentation/outsystems_developer_cloud/building_apps/set_as_secret/#setting-as-secret

So, we need to fill in the Setting.

  1. BDD Framework is a library, so open the app for tests in the ODC Portal, then AuthenticationSecretToken under Configuration > Settings
  2. Click the Edit button on the top right of the screen
  3. Fill in the Value Input and click the
  4. Wait for "Pending configurations" to be finished
  5. Open the test screen with the parameter "AuthToken=<the value we set in above step>"
Junji WatanabeJunji Watanabe

When I tried opening the BDD Framework in ODC Studio, the below message was shown.

I wanted to see how AuthenticationSecretToken Setting is defined.