| title | How-to get started with BDD test framework |
|---|
IMPORTANT!
-
Before you start watch this How to Design Tests in OutSystems in depth tech talk.
-
You must read the BDD framework documentation and do the exercises in your personal environment.
-
TOC {:toc}
-
Install the BDD framework from the Forge
-
Install the BDD framework reporting tool TBD forge component
- To install the BDD framework reporting tool go to /servicecenter/Applications_List.aspx and click on the publish application button. Upload the "BDD Framework Reporting.oap" and 1-Click Publish
-
Set the BDD framework rest api effective url
- In Service Center open the BDDFrameworkReporting module and open the integrations tab
- Navigate to the Consumed REST APIs section and open the BDDFrameworkV1 REST API
- Set the effective url to your environment base url e.g.,
https://synobsys.outsystemscloud.com/
-
Set the Timer_ExecuteNewRoundOfTestSuites schedule and activate the timer
- In Service Center open the BDDFrameworkReporting module and open the timers tab
- Click on the Timer_ExecuteNewRoundOfTestSuites
- Enter the desired schedule e.g. daily at 01:00 h
- Click on Activate to activate the timer if it is not active
Refer to the OutSystems Top-Notch Acceptance Criteria section for guidance on writing acceptance criteria. We create test scenarios based on the acceptance criteria written in the Given When Then format.
Now we create a Test Suite appplication that will contain the component tests and a core test services application that contains reusable logic to be used across test modules.
In LifeTime create a new application using the bddframework template.
-
Open your LifeTime environment Applications screen:
<yourlifetimeserver>/lifetime/Applications.aspx -
Create a new application parameters:
- Choose owner team: The team you application to test belongs to e.g., Talent Manager Team
- Choose the environment: Development
- What are you building? : BDDFramework
- Give the app a name following the naming convention
- Fill the description.
- Upload an icon. (We recommend to use the same icon as the application with a test watermark added)
-
Open the new application in ServiceStudio and create a new BDDFramework module name it like the module you are testing with the suffix
_Test -
In the MainTestFlow add a new screen and select the BDDFramework Data Drive Scenario (Static Enitity) template and name it
TestSuite. Please note that you must name the screenTestSuitefor the reporting tool to work.
-
This action also adds a WebBlock
DataDrivenDb_Scenariothat we keep as a template Together with this webblock a static entity named TestData is created and an aggregate is added to the preparation. -
Open the
TestSuitescreen and remove theScenarioListRecordsfrom the widget tree -
Move the WebBlock to the templates UIFlow
-
Delete the GetTestData aggregate from the preparation
-
Set the module description to "
<tested module name>tests module using BDDFramework" -
Publish the module
In LifeTime create a new application using the service template.
- Open your LifeTime environment Applications screen:
<yourlifetimeserver>/lifetime/Applications.aspx - Click on the button Create Application

- Create a new application parameters:
- Choose owner team: The team you application to test belongs to
- Choose the environment: Development
- What are you building? : Choose a service template e.g, Service, CoreServices_CS
- Name:
<tested module name>Core Tests - Description: Wrapper of common reused tests logic
- Upload an icon. (We recommend to use the same icon as the application with a test watermark added)
Feature: As a Talent Manager I should be able to manage skill and categories
Scenario: Add Skill Group
Given I am a Talent Manager
When I add a new Skill Group named "Play"
Then I should be able to get a successful result
PersonaLoginByName: GLogs in the with the specified persona name (Note this action may be already present in a generic test core service module)SkillGroupSampleGet: Initializes a sample Skill Group record with given fields
-
Copy the Sample_Test webblock and rename it to
TalentManagerAddSkillGroup -
Set the names of the Scenario and the Given-When-Then blocks:

-
Add the following logic to the b_Given screen action:
- Add an Assert webblock to the flow and set the name to AssertTalentManager
- Set Expected to:
"User is TalentManager" - Set Obtained to:
"User is " + If(LoggedInUserId = NullIdentifier(), "not logged in", If(CheckTalentManagerRole(LoggedInUserId), "", "not a ")) + "TalentManager"
-
Add the following logic to the d_Then screen action:
- Add an Assert webblock to the flow and set the name to
AssertSkillGroupCreated - Set Expected to
"SkillGroup record created successfully" - Set Obtained to
"SkillGroup record " + If(CreatedSkillGroupId <> NullIdentifier(), "created successfully", "not created")
- Add an Assert webblock to the flow and set the name to
-
Add the following logic to the e_Teardown screen action:
- Call SkillGroupDelete if a record was created
To add a test suite to the BDD framework reporting tool you must add the module names separated with a comma to the ModuleListCSV site property. E.g. TalentManager_CS_Tests



