com.vaadin.testbench.unit.
Class SpringUIUnit4Test
All Implemented Interfaces:
Base JUnit 4 class for UI unit testing applications based on Spring
Framework.
This class provides functionality of the Spring TestContext Framework, in
addition to set up a mock Vaadin Spring environment, so that views and
components built upon dependency injection and AOP can be correctly be
handled during unit testing.
Usually when unit testing a UI view it is not needed to bootstrap the whole
application. Subclasses can therefore be annotated
with @ContextConfiguration
or other
Spring Testing annotations to load only required component or to provide mock
services implementations.
@ContextConfiguration(classes = ViewTestConfig.class)
public class ViewTest extends SpringUIUnit4Test {
}
@Configuration
class ViewTestConfig {
@Bean
MyService myService() {
return new my MockMyService();
}
}
-
Field Summary
Fields inherited from class com.vaadin.testbench.unit.UIUnit4Test
treeOnFailure
Fields inherited from class com.vaadin.testbench.unit.BaseUIUnitTest
scanned, testers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Create mocked Vaadin core obects, such as session, servlet populated with Routes, UI etc.
Gets the services implementations to be used to initialized Vaadin
Lookup
.Methods inherited from class com.vaadin.testbench.unit.UIUnit4Test
printTree, testingEngine
Methods inherited from class com.vaadin.testbench.unit.BaseUIUnitTest
$, $, $view, cleanVaadinEnvironment, discoverRoutes, discoverRoutes, fireShortcut, getCurrentView, navigate, navigate, navigate, navigate, roundTrip, scanTesters, test, test
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.testbench.unit.TesterWrappers
test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test, test
-
Constructor Details
-
SpringUIUnit4Test
public SpringUIUnit4Test()
-
-
Method Details
-
lookupServices
Description copied from class:
BaseUIUnitTest
Gets the services implementations to be used to initialized Vaadin
Lookup
. Default implementation returns an empty Set. Override this method to provide custom Vaadin services, such asInstantiatorFactory
,ResourceProvider
, etc.Overrides:
lookupServices
in classBaseUIUnitTest
Returns:
set of services implementation classes, never null.
-
initVaadinEnvironment
public void initVaadinEnvironment()Description copied from class:
BaseUIUnitTest
Create mocked Vaadin core obects, such as session, servlet populated with Routes, UI etc. for testing and find testers for the components.
Overrides:
initVaadinEnvironment
in classUIUnit4Test
-