[Test Framework] Configure BDD tests with a range of input(s) to suport test cases?

Forge Component
(17)
Published on 2018-03-26 by Indigo Leap
17 votes
Published on 2018-03-26 by Indigo Leap

I like to use test cases, which I make using a static entity with various inputs and expected result(s).

Now I have recently started using Test framework with BDD framework and migrating our old tests into it. For a test with test cases I am using a BDD screen with an input parameter which is and Order of test case entity record. Then I can configure it in Test framework with URLs like /TestModule/Test.aspx?CaseNum=1, /TestModule/Test.aspx?CaseNum=2, etc. This works good, but I am wondering if there is any possibility to make this picked up automatically, or even dynamically?

So that, for example, I can somehow specify a range for input parameter and resulting cases will be automatically configured one by one. Or, ideally, to make it picked up dynamically on every run if I specify a source for an input parameter.

I see there are variables, but I don't understand how to use them, and introduction video shows how they are used only for service calls, but not BDD. And even with them, as it appears from the video, you need to specify specific value for specific case.

Another idea I have is to make the screen itself redirect to the next case after completion - I haven't tried this, but I assume that this way I will only see the result of the last case execution.

Did someone have experience with this maybe? Or is there some ready solution?

Hello Igor,
Test framework relies strongly on Outdoc component, which basically reads the OML file that represents the module. If you explore Outdoc by yourself, you will see that they dont export metadata about input parameters of each screen. Therefore, for now itsnt possible to make it dynamic.

unless Outsystems upgrade the outdoc component, which has been requested by big number of developers already in a while :)


Slavi Popov wrote:

Hello Igor,
Test framework relies strongly on Outdoc component, which basically reads the OML file that represents the module. If you explore Outdoc by yourself, you will see that they dont export metadata about input parameters of each screen. Therefore, for now itsnt possible to make it dynamic.

unless Outsystems upgrade the outdoc component, which has been requested by big number of developers already in a while :)



Ok, I understand. Still this is about "ideal" solution with automatic discovery. It will be fine if I could make the framework add several test steps automatically based on the range of parameters that I provide. So it looks like this is not supported. I will look into the framework tables and check if I can build a sort of API for this. So that my test module can call that API on deployment, saying that "if don't exist, add test steps with URL  /TestModule/Test.aspx?CaseNum={Var} for Var from 1 to 26".

I also wanted to do it with Excel export-import because in Excel you can at least easily copy the rows. But I was very confused with that every test step appeared there 4 times, which made it not that easy any more. :)

I understand your strugles, i had them also.

In Test framework, after dicovery, you can replicate one test to multiple tests, and create variables per each one, which are used to initiate the test.
This will create records in Test Framework Entities that you actually have several tests, and several variables per each test.

It is not possible to use the data from excel for testing. Unless you seriosly adapt test Framework for your needs. And still you will have the limitations of not be able to discover the input variables.
And tomorrow, a variable name change, and all tests related to that screen will fail.



I have found a simple solution for this.

I put the test inside a web block, and then put that web block into a page, calling it with a number, e.g. Test1.

I have made a function which retrieves the number (1) from URL and loads corresponding case.

Then all I need to do is copy the page Test1 as many times as many cases I have, which makes the number automatically increase. Then I can go to Test framework and discover them automatically.

When I will need to add a new test case - I will simply need to copy the page once again and rediscover in the framework. This way I also don't need to worry about my configuration being lost - it can be restored in just few clicks.

One con though is that some people can have license limitation on amount of screens, and we had this problem in the past, but luckily not any more.