Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CubicTest Eclipse plugin
We have just started using Vaadin for development and we now need to do our UI testing as well. Up to this point we have used the CubicTest plugin from our Eclipse IDEs to create all our Selenium UI tests. The tests get exported as Selenium HTML test scripts and we run these scripts via Selenium. I have also run these HTML test scripts via the Vaadin TestBench and they seem to be running fine. The CubicTest plugin makes use of Xpath expressions to retrieve the components from the screen. This seems to be impossible out of the box with Vaadin rendered screens, since viewing the source of a Vaadin rendered page does not show the actual HTML/source being displayed. This results in the tests not finding their components on the screen.
Is there a way to create Vaadin test scripts using CubicTest (or any Xpath based method for that matter), or is the only way to use the TestBench recorder?
As you have noticed, XPath selectors won't work with Vaadin and as such CubicTest probably will not work without adding support for vaadin locators. The easiest way to create Vaadin test scripts is with the TestBench recorder. It should also be possible to manually modify the XPath selectors to use Vaadin selectors, but that would be pretty boring and error prone work.
Thank you for your feedback. Is there no drive at the moment to customize CubicTest or write your own Eclipse plugin to create tests by dragging and dropping components on a canvas in Eclipse and setting the test parameters on property panes? This is our current workflow and allows our testers more freedom and flexibility in creating tests. Our testers have used the Selenium recorder but they all prefer the CubicTest way.
Unfortunately there's no integration with CubicTest and unfortunately I know too little about the tool to be able to help here.
We've just started working on TestBench 3.0, but I can't make any promises at this point. Your wish to be able to use CubicTest
with Vaadin TestBench has been duly noted, though!
Thank you for your feedback. We will continue with TestBench recorder then.
Another thing occurred to me upon reflection. You can provide debug IDs for the components you need to access in your tests with component.setDebugId("xxx"). The ID needs to be unique, but it might be enough to make recording with CubicTest possible.
Thanks for reflecting on my problem. :-) I shall try this and see if it is possible.
Thanks again for your suggestion. I have done a quick test but this still does not seem to give me the necessary component from the source. This id ends up on a div one or more levels higher than the actual component (depending on what component I use). This would be a great solution to our problem, but then the Vaadin team would have to make some changes to ensure that the id gets added to the actual component and not the wrapping div component.
Would this be possible?
Kind regards and thanks in advance.
Unfortunately I think that that kind of change would cause too large changes as well as too much ambiguity and be difficult to implement. Take DateField for instance. Which element gets the ID? The text input or the calendar popup button?
A better solution would be to add Vaadin selector support to CubicTest. We'll look into this for the next version of TestBench.