I’m proud to announce our new Open Source tool! Masquerade - testing library for CUBA-based applications.
Masquerade is a set of libraries for automating user interface testing and ensuring regressions get caught. You can easily build tests that catch everything from UI changes to database quirks, maintain the test in any JVM language and run them manually or in your CI environment.
The library provides an ability to create UI tests for CUBA-based applications using masquerade-web module. Also, you can create REST-API tests with masquerade-connector module.
Essentially, masquerade is based on well-known libraries such as selenium and retrofit2 and brings a lot of features for testing of CUBA applications. It makes it easier to start writing UI tests without hustle.
If we look closely enough we will see that UI tests could be simple and expressive:
public class LoginWindowTest {
@Test
public void loginTest() {
open("http://localhost:8080/app");
LoginWindow loginWindow = Components.wire(LoginWindow.class);
loginWindow.loginField
.shouldBe(EDITABLE)
.shouldBe(ENABLED);
loginWindow.loginField.setValue("admin");
loginWindow.passwordField.setValue("admin");
loginWindow.rememberMeCheckBox.setChecked(true);
loginWindow.loginSubmitButton
.shouldBe(VISIBLE)
.shouldBe(ENABLED)
.shouldHave(caption("Submit"));
loginWindow.loginSubmitButton.click();
}
}
And no HTML magic required!
We are already using masquerade tool suite for the platform itself. Moreover, it is used in products and projects that we are building at Haulmont for almost a year now.
Mmmm. I think we’re going to have to agree to disagree on that one.
Your solution needs two fields for each component, and one of those is still a nullable.
Mine is less lines and uses immutable objects which I prefer, though It does mean I need to set ids and/or classes on the components I need to reference.
And the private field has to share the name of the cuba id on the element for this to work, so I think the private var field has to be called loginField
if I want test menu item of main app shouldBe(VISIBLE) . How can I do it ? I want test if showed an item menù when I login with differents users roles. If present I can using
I’d like to know if there is also a recorder functionality available with this addon? This would be great for our testing guys as they don`t want to be bothered with coding ;-). Or is there an integration with the regular Selenium IDE?
The main focus of the library is coding, simple and convenient code for tests. That’s why we are not planning to implement a recorder or visual tool for now.
Just to clarify, the idea of visual tool for testing is great. Unfortunately, it requires a lot of resources. We will see if we can go in this direction in the future.