BDD Testing Framework

  
Hi everyone,

I've just published a new component to the forge called the BDDFramework, which provides a set of tools for easily creating BDD / TDD style tests for your OutSystems Applications.
The main focus is testing the logic of your modules, by exercising the critical actions that support your app's use cases.



You can check this demo video where we show how to use the framework to create a test for a piece of logic of the eCommerce app.

Main highlights of the component:

  • Create test scenarios and steps that are conformant to the principles of Behavior Driven Development.
  • Enable Test Driven Development - you can define scenarios and steps early in the app design stage and write the test code when the features have been implemented.
  • Easily add scenarios and steps by dragging and dropping web blocks (Scenario + Given / When / Then clauses).
  • Each step is implemented in its own action, making sure that steps are sequential and occur in the same request.
  • Enhance Test Maintenance - test outputs are identical to what is designed in Service Studio, making it easy to pinpoint step failures and evaluate the code behind them.
  • Supports multiple tests in the same page and evaluating final stats (number of successful / failed tests).
  • Open-source component which you can improve and change to your own needs.

Hope you find it useful!

Cheers!

 Hi  Joao,

This is indeed a great tool, I'm a new Outsystems user and I was able to create a small test. 
I think this is a good easy to use tool for unit test level for Outsystems applications that give the user the above mentioned benefits. So thank you for this!

Question: BDD tools supports also specification by example. I mean her support of parametrization and data in table format, similar with scenario outline in SpecFlow and Cucumber. 

 see below

Scenario Outline: eating
  Given there are <start> cucumbers
  When I eat <eat> cucumbers
  Then I should have <left> cucumbers

  Examples:
    | start | eat | left |
    |  12   |  5  |  7   |
    |  20   |  5  |  15  |

Do BDDFramework support this feature?
any plans for this?
Hi Rachid!

Thank you for your feedback!

I had not thought of the scenario you mentioned, but I believe you can achieve something quite compatible in the OutSystems Platform in a easy way through a web block.

If you take your example: you could create a new web block (let's call it "Eating") in the eSpace where you are building your tests and add three input parameters - Start, Eat, Left.
You can then drag a BDDScenario block (from the framework) inside the Eating block and add the Given, When, Then clauses you mentioned, with the corresponding actions for each step.

You'll get an "Eating" block that you can reuse several times inside a test screen - for each instance of the "Eating" block you set different values to the Start, Eat and Left parameters to test different values.

Hope this helps.

Cheers!
Hi João,

Thanks for your reaction. With your solution based on web block, we can indeed realise my proposed feature. However it is not completly the idea that i want to achieve.

My idea is to extend your tool with a component that can be re-used in such a way that table and the data becomes visible in the scenario outline as mentioned in my previous post. my idea is to achive a readbale specification by example.
With the solution you proposed, the data will not be visible in the scenario's but will be hiden in the code.

One principle of BDD and specfification by example is that the test cases (in Given-When-Then + table outline) becomes a commen readable specification. and can be used as an ubiquitous language, a (semi-)formal language that is shared by all members of a software development team — both software developers and non-technical personnel. The language in question is both used and developed by all team members as a common means of discussing the domain of the software in question. In this way BDD becomes a vehicle for communication between all the different roles in a software project.

Kind regards

Rachid
 

Hi Rachid,

I see what you mean with the "data" for the test scenario and how it helps in terms of specification by example. 
It is indeed an interesting concept that we didn't consider when developing the BDD Framework, but if you end up extending the component in such a way, please do share your experience with us!

Cheers!