Annotation Interface UiTest


@Target(TYPE) @Retention(RUNTIME) @ExtendWith({org.springframework.test.context.junit.jupiter.SpringExtension.class,JmixUiTestExtension.class}) @Documented @Inherited public @interface UiTest
The annotation is used for testing Jmix screens on JUnit.

For instance:

 @UiTest(authenticatedUser = "admin", mainScreenId = "MainScreen", screenBasePackages = "com.company.demo.screen")
 @ContextConfiguration(classes = {DemoApplication.class, UiTestAssistConfiguration.class})
 public class UserBrowseTest {

     @Test
     protected void openUserBrowse(Screens screens) {
         UserBrowse screen = screens.create(UserBrowse.class);
         screen.show();
     }
 }
 
Screens bean can be obtained from method parameters or via BeanFactory.getBean(Class).
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The username that should be authenticated before each test.
    The main screen id that should be opened before each test.
    Screens under these packages will be available in test.
  • Element Details

    • authenticatedUser

      String authenticatedUser
      The username that should be authenticated before each test. If username is not set, authentication will be performed by system user.
      Default:
      ""
    • mainScreenId

      String mainScreenId
      The main screen id that should be opened before each test. The screen with given id should be placed under one of packages that are provided by screenBasePackages().

      If main screen id is not set, the UiProperties.getMainScreenId() will be used.

      Default:
      ""
    • screenBasePackages

      String[] screenBasePackages
      Screens under these packages will be available in test. If packages are not set, all application screens will be available depending on the test's configuration.
      Default:
      {}