Annotation Interface VaadinAppConfiguration


@Target(TYPE) @Retention(RUNTIME) @WebAppConfiguration @TestExecutionListeners({VaadinTestExecutionListener.class,org.springframework.test.context.support.DependencyInjectionTestExecutionListener.class,org.springframework.test.context.support.DirtiesContextTestExecutionListener.class,org.springframework.test.context.transaction.TransactionalTestExecutionListener.class}) public @interface VaadinAppConfiguration
Place this annotation on test classes that:
  • are run with the SpringJUnit4ClassRunner,
  • use autowiring to inject managed beans into the actual test, and
  • perform tests on beans that are view scoped, UI scoped or session scoped
With this annotation in place, all beans that are UI-scoped or VaadinSession-scoped will work as expected. The indented use case for this approach is to test non-visual components like presenters or controllers. It is not usable for testing Vaadin components or actual UI instances.

Example of usage:

   @RunWith(SpringJUnit4ClassRunner.class)
   @VaadinAppConfiguration
   @ContextConfiguration(classes = ExampleIntegrationTest.Config.class)
   public class MyTest {

       @Autowired MyUIScopedController myController;

       ...
   }
   
Author:
Petter Holmström (petter@vaadin.com)
See Also: