Hi everyone,
Here's an update: a new version of the BDD Framework has just been published that includes a REST API for running tests.
You'll still develop tests the same way you've done up until now, but you also have the option to run them through this new API, enabling a more direct integration to other tools you may already use to manage your tests.
Once you publish the new 1.2.1 version of the component, check out the REST API documentation at
https://<YOUR_ENVIRONMENT_HOST>/BDDFramework/rest/v1/#!/v1/
You'll see there's a single API method called BDDTestRunner you can call, passing the name of the eSpace that contains the tests and the corresponding test suite screen (through "rest/v1/BDDTestRunner/{TestESpace}/{TestSuiteScreen}").
Let's say you use the API to successfully run a single test contained in a test screen. The output you should obtain is a JSON such as the following:
{ "SuiteSuccess":true, "SuccessfulScenarios":1, "FailedScenarios":0, "FailureReports":[ ], "ErrorMessage":"" }
However, if you run another screen that has 2 BDDFramework tests, in which one is successful and the other fails, you'll obtain something like this:
{ "SuiteSuccess":false, "SuccessfulScenarios":1, "FailedScenarios":1, "FailureReports":[ "------------------------------------\r\nScenario\r\nWhen a user adds a product to the cart, it should be correctly updated\r\n------------------------------------\r\nGiven\r\nGiven that I have a cart [P] \r\nAnd there is a product called \"Prosecco Armani DOC\" [P] \r\n\r\nWhen\r\nWhen I add the product to the cart [P] \r\n\r\nThen\r\nThen the operation should be successful [P] [F] [P] \r\n [F] Expected \"Message: 1 Barca Velha added to your shoppping cart\" but obtained \"Message: 1 Prosecco Armani DOC added to your shoppping cart\"\r\nAnd the cart should have been correctly updated [Skipped]\r\n------------------------------------\r\n\r\n" ], "ErrorMessage":"" }
The data includes a failure report with the stripped down BDD output from the test that failed. Once you unescape that report:
------------------------------------ Scenario When a user adds a product to the cart, it should be correctly updated ------------------------------------ Given Given that I have a cart [P] And there is a product called "Prosecco Armani DOC" [P] When When I add the product to the cart [P] Then Then the operation should be successful [P] [F] [P] [F] Expected "Message: 1 Barca Velha added to your shoppping cart" but obtained "Message: 1 Prosecco Armani DOC added to your shoppping cart" And the cart should have been correctly updated [Skipped] ------------------------------------
You'll see that the information is the same you would see by running the test in the screen itself through a browser:
We have found this to be useful when integrating with other tools, since you can include the full test output for each test run report, thus accelerating the analysis of test failures.
Happy Testing!