I am the part of a team, which develops a single sourced RAP-RCP client application. We would like to use Jubula to create automatized tests, which would fit both client type. As far as I know if I stick to the lower level concrete toolkit, and I can make it working with our RAP client, I can test both clients with it. It would worth for us to put a bit more effort in RCP test design with using lower level building blocks, to get RAP compatibility on the other side.
So currently my problem is the way, how Jubula identifies HTML (or RCP) components. In RAP there is the possibility to define CUSTOM_WIDGET_ID with the Widget.setData(String key, Object value) method, and this id will be generated into the HTML code.
How it works:
- When I set this id for a text input unfortunately the result in HTML is a bit different than expected. There is a DIV, which contains my input element, and this DIV will have the ID, which I have defined.
- If I do not define such id, then all widgets without defined id will become a sequence number, which is variing with each run. It looks like wXXX where XXX is the sequence number
If I want to use Jubula as it is now, I am facing with the problem, that all components in the widget tree has to have some fixed ID, which is not variing, but unique. So for example this would be a textfield in Jubula ideally:
Generating such ID (unique, reproducable, meaningful) for the noname composites, which does not have any label, is hard, or nearly impossible. If I would give an ID just for the textfield, I would have something like this for the same textfield:
So from my viewpoint it would be great to have some feature in Jubula, which would let me edit or define the object mapping technical element. As far as I know it is possible to match HTML elements in Selenium using XPath. If I could define in my test a technical element like //div[id='MyTextField']/input, I could avoid defining every single ID in the tree, and I could provide the needed flexibility to find the input inside the marked DIV, which has my ID.
As for RCP, you could have the same flexibility. If you would take for example the Shell object, and use it as the context bean of a JXPath evaluator, it would be relatively easy to have the same XPath based matching there as well.
With XPath matching it would be also possible to match or assert elements in insanely flexible way. Like I want to match the textfield, which is red. It sounds cool, does not it? I know that Jubula is not intended to be a test tool, which is designed for freak developers using xpath, but it would be still extremely powerful to have such a feature.
I would be generally interested in your opinion about this, and I would welcome any information about extension points in Jubula, which could be used to implement this behavior.