platform icon indicating copy to clipboard operation
platform copied to clipboard

AC: Testing story for Flow: TestBench + Karibu

Open mshabarov opened this issue 3 years ago • 0 comments
trafficstars

Description

Vaadin TestBench provides a set of tools and helpers to write an end-to-end tests for Vaadin applications. Whereas it gives developers a rich API to simulate user interaction with the application and covers the whole chain from the user action to the executing business logic on the server-side, it takes more time comparing with the unit tests because it needs to start the application server, browser, establish network connections and so on. In a cases when we can sacrifice the browser/app server interaction, want to speed up UI tests (including parallelisation, which is for end-to-end test sometimes makes troubles) and simplify them, the UI unit testing shall come to the rescue.

Vaadin Karibu Testing project is a original implementation of this idea. Within this testing story ticket we'd like to add this feature into our TestBench framework.

The following code snippet shows an example of testing Vaadin hello world view:

class HelloWorldViewTest extends UIUnitTest {

@Test
public void validateTextFieldUsage() {
   final HelloWorldView helloView = navigate(HelloWorldView.class);

   $(TextFieldWrap.class, helloView.name).setValue("Test");
   $(ButtonWrap.class, helloView.sayHello).click();

   NotificationWrap notification_ = select(NotificationWrap.class).first();
   Assertions.assertEquals("Hello Test", notification_.getText());
}

Use cases

As a developer I want to test my UI components/views in a unit tests manner without end-to-end browser interactions and starting the application server, So that I can focus on testing my features and not on browser/app server specifics.

Acceptance criteria

  • [ ] It shall be possible to interact with the UI component on the Vaadin page/view in a regular unit test, without configuring an app server and opening a page in the browser.
  • [ ] Flow html components and free Vaadin components shall have a corresponding API for interacting with them from the unit test.
  • [ ] Commercial Vaadin components shall have a corresponding API for interacting with them from the unit test.
  • [ ] UI unit testing shall be included into TestBench framework.

General criteria

  • [ ] APIs reviewed
  • [ ] Design
  • [ ] Performance
  • [ ] UX/DX tests in Alpha
  • [ ] Documentation:
  • [ ] How to test?
  • [ ] Limitations:

mshabarov avatar May 31 '22 05:05 mshabarov