How-to get started with BDD test framework
IMPORTANT!
- 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
Writing test scenarios
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.
Creating a new test suite
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.
Create Test Suite application
In LifeTime create a new application using the bddframework 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 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 screen TestSuite
for the reporting tool to work.
Create Core Test Services
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)
Building a test scenario example
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
Preparation steps
Create reusable actions in module TalentManagerCoreTests_CS
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
Implement the scenario
- 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 a_Setup screen action:
- 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 c_When screen action:
- 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 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
Reference