Commit Graph

116 Commits

Author SHA1 Message Date
Phillip Webb 54aeff47a2 Add exclude support to @ImportAutoConfiguration
Update `@ImportAutoConfiguration` with support for an exclude attribute
that works in a similar way to `@EnableAutoConfiguration`.

Also update existing `@Test...` annotation with exclude attribute
aliases.

Fixes gh-6809
2016-12-30 00:31:30 -08:00
Phillip Webb 8b69856fc9 Polish 2016-12-28 15:23:26 -08:00
Phillip Webb 6121208cbb Polish formatting 2016-12-19 12:47:03 -08:00
Phillip Webb 4b9cba351b Merge branch '1.4.x' into 1.5.x 2016-12-19 12:36:57 -08:00
Phillip Webb bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Stephane Nicoll 21b815aabd Polish contribution
Closes gh-7560
2016-12-16 10:52:43 +01:00
Eddú Meléndez 5a7624df7c Add support for property spring.test.database.replace
Closes gh-7229
2016-12-16 09:40:55 +01:00
Stephane Nicoll d8d5950e99 Enable validation in `AutoConfigureWebMvc`
Closes gh-7582
2016-12-15 16:55:34 +01:00
Stephane Nicoll ee72e788ed Rename `spring-boot-junit-runners` to `spring-boot-test-support`
Closes gh-7421
2016-12-01 16:25:47 +01:00
Johnny Lim 423f8037ce Polish
Closes gh-7530
2016-11-30 08:31:13 +01:00
Stephane Nicoll 80da80f930 Make sure that test data sources are unique 2016-11-29 18:07:36 +01:00
Stephane Nicoll ba61faee5e Remove trailing char 2016-11-29 15:37:05 +01:00
Stephane Nicoll b618c70e52 Add test slice for pure jdbc tests
This commit adds `@JdbcTest`, a new test slice for pure jdbc tests. It
provides the same basic features than `@DataJpaTest`.

Closes gh-6563
2016-11-29 14:54:15 +01:00
Phillip Webb 5ed00b3501 Merge branch '1.4.x' into 1.5.x 2016-11-28 15:27:07 -08:00
Phillip Webb 357d072a60 Polish 2016-11-28 15:14:46 -08:00
Stephane Nicoll ca788a90e6 Merge branch '1.4.x' into 1.5.x 2016-11-24 15:31:40 +01:00
Stephane Nicoll 4bf645c615 `AutoconfigureTestDatabase` replace with a fresh database
Previously, two or more `@DataJpaTest` tests in the same test suite were
sharing the same in-memory database instance. This commit makes sure
that `TestDatabaseAutoConfiguration` creates a unique embedded database
for each test it operates on.

Closes gh-7473
2016-11-24 15:31:27 +01:00
Phillip Webb dc237043b8 Merge branch '1.4.x' into 1.5.x 2016-11-22 15:48:52 -08:00
Phillip Webb 74670cb20f Allow WebDriver beans to define their own scope
Update `WebDriverScope` so that only `WebDriver` beans with no explicit
scope are moved.

Fixes gh-7454
2016-11-22 15:48:28 -08:00
Andy Wilkinson b2a8be8bbe Merge branch '1.4.x' into 1.5.x 2016-11-21 13:40:11 +00:00
Andy Wilkinson 3423ca87b4 Ensure that RestClientTest can be used without Jackson on the class path
Closes gh-7431
2016-11-21 13:36:05 +00:00
Phillip Webb 764f13453a Merge branch '1.4.x' into 1.5.x 2016-11-15 13:58:54 -08:00
Phillip Webb bacf0878af Polish 2016-11-15 10:40:21 -08:00
Spring Buildmaster e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Stephane Nicoll 5878e5eec5 Merge branch '1.4.x' into 1.5.x 2016-11-08 10:57:58 +01:00
Stephane Nicoll 318701daa7 Apply DispatcherServlet customizations to MockMvc
This commits makes sure that customizations on `DispatcherServlet` are
also applied to the `TestDispatcherServlet` that `MockMvc` is using
internally.

Closes gh-5891
2016-11-08 10:56:54 +01:00
Stephane Nicoll 3018e95261 Merge branch '1.4.x' into 1.5.x 2016-11-06 11:44:12 +01:00
Stephane Nicoll ebfd86ea26 Polish contribution
Closes gh-7326
2016-11-06 11:42:45 +01:00
sebastiankirsch e8b0a64872 Add @Inherited to all AutoConfigure* classes
See gh-7326
2016-11-06 11:39:12 +01:00
Phillip Webb 5b66ffbb4b Merge branch '1.4.x' into 1.5.x 2016-10-31 23:09:36 -07:00
Greg Potter 39d5881bf2 Respect 'primary' flag when replacing databases
Update TestDatabaseAutoConfiguration to ensure that the the `primary`
flag of the `BeanDefinition` is copied.

Closes gh-7217
2016-10-31 16:26:41 -07:00
Stephane Nicoll 4855bfb152 Merge branch '1.4.x' into 1.5.x 2016-10-24 11:11:56 +02:00
Stephane Nicoll a03ce0a9d1 Polish contribution
Add missing test

Closes gh-7193
2016-10-24 11:11:15 +02:00
Johnny Lim 0b5fbbedf4 Add a missing return
This commit adds a missing`return` in `getDataSourceBeanDefinition()`.

See gh-7193
2016-10-24 10:41:20 +02:00
Stephane Nicoll 6bd670edbc Initiate 1.4.x branch 2016-09-21 11:11:24 +02:00
Spring Buildmaster 7e9ed5e1a7 Next Development Version 2016-09-21 07:58:07 +00:00
Johnny Lim a994b11a73 Polish 2016-09-18 23:38:21 -07:00
Phillip Webb e239e64cb1 Only print MVC interactions when tests fail
Update `@AutoConfigureMockMvc` with a `printOnlyOnFailure` option which
allows errors to be printed only when tests fail. Defaults to `true`
meaning the logs are no longer cluttered with MVC results for passing
tests.

Fixes gh-6653
2016-09-18 23:37:46 -07:00
Andy Wilkinson 0a9bcd9893 Polish 2016-09-18 10:29:14 +01:00
Phillip Webb ac2609b585 Fix WebDriver lifecycle issues
Update WebDriver support to ensure that the `.quit()` method is called
after each test method runs and that a new WebDriver instance is
injected each time.

Support is provided by introducing a new `Scope` which is applied by
a ContextCustomizerFactory and reset by a TestExecutionListener.

Fixes gh-6641
2016-09-18 00:18:29 -07:00
Phillip Webb 0ef845b96e Polish 2016-09-17 20:05:21 -07:00
Phillip Webb 82ae6e4049 Improve @AutoConfigureTestDatabase failure message
Fixes gh-6916
2016-09-17 19:56:25 -07:00
Phillip Webb 2c621f4094 Fix @AutoConfigureTestDatabase imports
Update `@AutoConfigureTestDatabase` so that it always imports
`DataSourceAutoConfiguration`. Prior to this commit the annotation
could only be applied if something else also imported DataSource
auto-configuration.

Fixes gh-6897
2016-09-16 16:49:36 -07:00
Phillip Webb 3e19f8aa8d Relax TestEntityManager @ID restriction
Change TestEntityManager so that entities with an ID can be persisted.

Fixes gh-6546
2016-09-15 17:22:52 -07:00
Phillip Webb 25c4e261e9 Fix failing tests
See gh-6897
2016-09-15 17:16:26 -07:00
Phillip Webb 46815fc483 Fix potential @AutoConfigureTestDatabase NPE
Protect against the situation where no DataSource beans can be found
at all.

Fixes gh-6897
2016-09-15 16:06:56 -07:00
Phillip Webb ebb08c3655 Generate property meta-data for test projects
Add annotation processor to `spring-boot-test` and
`spring-boot-test-autoconfigure`.

Fixes gh-6893
2016-09-15 10:14:21 -07:00
Phillip Webb 7134586310 Ensure test @PostConstructs are only called once
Rename AutoConfigureReportTestExecutionListener to
SpringBootDependencyInjectionTestExecutionListener and ensure that it
replaces any existing DependencyInjectionTestExecutionListener.

Prior to this commit the registration of two DependencyInjection
listeners would cause @PostConstruct methods on tests to be called
twice.

In order to allow the standard DependencyInjectionTestExecutionListener
to be removed a new DefaultTestExecutionListenersPostProcessor interface
has been introduced.

Fixes gh-6874
2016-09-14 22:03:07 -07:00
Phillip Webb 41a36c4d40 Prevent CastCastException when stripping root URI
Update RootUriRequestExpectationManager to only wrap requests when
they cannot be cast to MockClientHttpRequest. This prevents later
ClassCastExceptions from being thrown with @RestClientTests that
define expected body content.

Fixes gh-6845
2016-09-12 12:44:31 -07:00
Phillip Webb 41dc53f5dd Polish 2016-09-07 08:34:45 -07:00