Skip to content

testerBot #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 145 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
d3990f2
initial commit of client testing, copied from Spring Social's test mo…
habuma Jun 24, 2011
abd8261
Fix compile error in tests
rstoyanchev Jun 25, 2011
6fcdb09
Refactor result matchers and print action, rename package match->resu…
rstoyanchev Jun 26, 2011
aae27e8
Update readme
rstoyanchev Jun 30, 2011
dacdbf3
Add distributionManagement URL for nightly snapshot releases to http:…
rstoyanchev Jul 20, 2011
ec91603
Temporarily comment out line causing test failure on build server
rstoyanchev Jul 20, 2011
0800f32
Added Maven snapshot repository url
Sep 6, 2011
4e67176
Polish and some refactoring in server-side code:
rstoyanchev Sep 6, 2011
7b7be2b
Merge pull request #4 from irfn/master
Sep 6, 2011
92a9c40
Change the README's code to use status(HttpStatus).
Sep 9, 2011
a90c271
Build MockMvc with TestContext's ApplicationContext
Sep 15, 2011
7be3499
refactoring
Sep 19, 2011
8d45564
added all HttpStatus as is* methods to ServletResponseMatchers
Sep 20, 2011
69256ee
added a little tests for isXXX() methods
Sep 20, 2011
912fa4c
- moved the isXyz() methods and status(HttpStatus) to separate class …
whiteship Sep 22, 2011
910873b
modified README.md's code to use response().status().isXyz() and resp…
Sep 22, 2011
ab283a5
IMPROVE CONTENT MATCHING, RE-ORGANIZE TESTS, AND MORE
rstoyanchev Sep 27, 2011
6d82746
Fix command line test error
rstoyanchev Sep 27, 2011
f75796a
Add part of pom.xml that was commented out temporarily.
rstoyanchev Sep 27, 2011
b3d1516
Merge branch 'master' of https://github.com/SpringSource/spring-test-mvc
Sep 29, 2011
0f15c8d
Refactoring the codes in a manner of the 'master' of https://github.c…
Sep 29, 2011
03629e0
Polish
rstoyanchev Oct 5, 2011
7d04c51
add comments on the StatusResultMatchers.
Oct 6, 2011
88d629f
Support for HandlerMethodArgumentResolver in Standalone setup
Oct 6, 2011
c015d00
Use setCustomArgumentResolvers instead of the incorrect setArgumentRe…
Oct 6, 2011
8e65520
Merge pull request #9 from nilsga/master
Oct 7, 2011
12cd14c
polish
rstoyanchev Oct 7, 2011
80579d2
polish
rstoyanchev Oct 7, 2011
0818752
added isNotFound(String msg)
Oct 7, 2011
73ecc06
Add mvcSetupInitialized extension hook in AbstractMockMvcBuilder.
rstoyanchev Oct 18, 2011
9b703d9
Add Flash attribute support to MockDispatcher.
rstoyanchev Oct 18, 2011
a12b93a
refactoring isNotFound(String)
Oct 19, 2011
633792d
Merge branch 'master' of https://github.com/SpringSource/spring-test-mvc
Oct 19, 2011
b2b463c
added overriding methods.
Oct 19, 2011
436b93c
Add MockMvcBuilder interface, remove option to build from bean defs.
rstoyanchev Oct 20, 2011
4044ec1
Polish StandaloneMockMvcBuilder
rstoyanchev Oct 20, 2011
e3ffdab
Merge branch 'master' of https://github.com/SpringSource/spring-test-mvc
Oct 21, 2011
7026a16
Add example of using TestContext framework.
rstoyanchev Oct 27, 2011
9cf89b0
Minor update
rstoyanchev Oct 28, 2011
e1192ef
Merge branch 'master' of https://github.com/keesun/spring-test-mvc in…
rstoyanchev Oct 28, 2011
a7e5aa3
Minor correction to patch
rstoyanchev Oct 28, 2011
533783c
Updated examples
Nov 4, 2011
6149b94
Merge pull request #11 from firstbanco/master
Nov 4, 2011
731ce1c
Review and refactor API for expectation setting with ResultMatchers.
rstoyanchev Nov 15, 2011
63e1064
Introduce MvcResult structure.
rstoyanchev Dec 5, 2011
ef91d2d
Upgrade verion of Spring to 3.1 GA
rstoyanchev Dec 13, 2011
7559e21
Fixed ModelResultMatchers.attributeExists() to call match() on the ma…
habuma Dec 21, 2011
6e79f1e
Added test to confirm that ModelResultMatchers.attributeExists() works
habuma Dec 21, 2011
9a68561
Fixed pom.xml
habuma Dec 21, 2011
63ccf7e
Merge pull request #16 from habuma/master
rstoyanchev Dec 22, 2011
e693ff2
Fixed FlashAttributeResultMatchers to invoke matcher returned from at…
habuma Dec 22, 2011
b90b64b
Merge pull request #17 from habuma/master
rstoyanchev Dec 23, 2011
3eb93f1
Polish and add a few tests.
rstoyanchev Dec 23, 2011
4e93db3
Add link to presentation in README
rstoyanchev Jan 20, 2012
38a1416
Internal refactoring around MvcSetup and MockDispatcher
rstoyanchev Feb 10, 2012
24d18b3
Prepare for Spring 3.1.1 release
rstoyanchev Feb 16, 2012
df6f9aa
Fix bug setting Accept header
rstoyanchev Feb 24, 2012
12d4eff
Whitespace changes
rstoyanchev Feb 24, 2012
14937ad
Fix failing test related to previous commit
rstoyanchev Feb 24, 2012
e9d7599
Add ContextMockMvcBuilder.setParentContext()
tbruyelle Mar 7, 2012
70693ba
Merge pull request #26 from tbruyelle/master
rstoyanchev Mar 13, 2012
1c9f525
Extend CookieResultMatchers
tbruyelle Mar 13, 2012
228b4c1
Merge pull request #27 from tbruyelle/cookieResultMatcher
rstoyanchev Mar 16, 2012
1c40a88
Polish
rstoyanchev Mar 16, 2012
de78faa
Add missing pluginRepository
rstoyanchev Mar 17, 2012
23775bb
Remove file comitted by mistake
rstoyanchev Mar 21, 2012
ae7bc0d
Fix #28 Add isArray to jsonPath
tbruyelle Mar 20, 2012
036fef5
Merge pull request #29 from tbruyelle/rebasing
rstoyanchev Mar 21, 2012
22532cf
Upgrade to spring 3.1.1, hibernate-validator 4.2
rstoyanchev Mar 21, 2012
7ce0b72
Add sample for loading a context from Java config.
scottfrederick Mar 30, 2012
46e65eb
Added model matcher to verify field errors in the model.
scottfrederick Apr 5, 2012
308880b
Added the ability to pass a HttpHeaders object to a RequestBuilder, a…
scottfrederick Apr 6, 2012
8e8ed4c
Polish
rstoyanchev Apr 10, 2012
bf098ee
Merge branch 'matchers' of https://github.com/scottfrederick/spring-t…
rstoyanchev Apr 10, 2012
9fbf4a2
Remove attributeErrors result matcher
rstoyanchev Apr 10, 2012
00d2842
Merge branch 'client' of https://github.com/scottfrederick/spring-tes…
rstoyanchev Apr 10, 2012
f721de6
RequestMatcher improvements
rstoyanchev Apr 10, 2012
fd4d265
Add methods to verify field errors
scottfrederick Apr 11, 2012
b735ef0
Support for publishing a sources jar.
youngm May 3, 2012
d8875fa
Merge pull request #35 from youngm/master
rstoyanchev May 4, 2012
dcb7235
Add secure parameter to DefaultRequestBuilder
May 11, 2012
948545c
Derive rather than specify pathInfo
rstoyanchev Jun 12, 2012
390d684
Add support for setting the query string
joergrathlev Mar 29, 2012
6321b9e
Fix issue with prior commit and polish
rstoyanchev Jun 27, 2012
2fb1ded
Update deployment options in pom.xml
rstoyanchev Jun 27, 2012
1f3842e
Add builder-style methods to ResponseCreators
rstoyanchev Jun 27, 2012
64d4360
Release version 1.0.0.M1
spring-builds Jun 27, 2012
a13e1ed
Increment version to 1.0.0.BUILD-SNAPSHOT
rstoyanchev Jun 28, 2012
25ecfca
Update readme for milestone release
rstoyanchev Jun 28, 2012
56084e2
Update README with regards to opening issues
rstoyanchev Jul 2, 2012
d733a9b
Fix white space formatting in pom.xml
rstoyanchev Jul 3, 2012
ee8801f
Add suffix pattern and trailing slash options
Jul 2, 2012
e60e0a3
Merge pull request #43 from fransflippo/master
rstoyanchev Jul 12, 2012
070010c
Updates to GenericWebApplicationContextLoader
rstoyanchev Jul 12, 2012
113cb3f
Fix issue with imported class from last commit
rstoyanchev Jul 12, 2012
75062f2
Changed to make Java 1.5 compliant
rwinch Jul 12, 2012
ac3c523
Add animal-sniffer-maven-plugin
rwinch Jul 13, 2012
e26d1c8
Update DefaultRequestBuilder javadoc
rwinch Jul 12, 2012
5d86743
Merge pull request #48 from rwinch/DefaultRequestBuilder-javadoc-update
rstoyanchev Jul 13, 2012
db4733a
Update dependency declaration in README.md
rwinch Jul 12, 2012
99ed5a5
Merge pull request #49 from rwinch/readme-include-test-scope
rstoyanchev Jul 13, 2012
010d694
Add session-related methods to DefaultRequestBuilder
svenfila Jul 16, 2012
ed40890
Merge pull request #53 from svenfila/master
rstoyanchev Jul 17, 2012
d6003ae
Add licensing information to README
rstoyanchev Jul 25, 2012
b68d07d
Fixed ResponseCreators.withResponse(Resource, HttpHeaders, HttpStatus…
habuma Aug 23, 2012
d6fe83c
Made DefaultResponseCreator to be public, as its builder methods retu…
habuma Aug 23, 2012
e76563b
Fix typo in Maven dependency example
cbeams Sep 5, 2012
40b86ad
Update client-side REST test support
rstoyanchev Sep 8, 2012
120c631
Add mock client HTTP request implementations
rstoyanchev Sep 12, 2012
aa0903e
Add support for using Servlet Filter's
rwinch Aug 31, 2012
203b230
Merge pull request from rwinch/filters
rstoyanchev Sep 13, 2012
9eb3acb
Make the constructor of DefaultRequestBuilder protected
rstoyanchev Sep 13, 2012
d2510b7
Rename methods called type to mimeType
rstoyanchev Sep 13, 2012
7627aeb
Clean up warnings in test code
rstoyanchev Sep 13, 2012
1bcce7b
Update DefaultRequestBuilder
rstoyanchev Sep 14, 2012
d9c6123
Adjust cookie existence checks
rstoyanchev Sep 14, 2012
f807abe
Move MockFilterChain back into spring-test-mvc package
rstoyanchev Sep 14, 2012
164ba41
Fix builder methods not returning "this"
rstoyanchev Sep 15, 2012
3153030
Fix bug in setting pathInfo
rstoyanchev Sep 15, 2012
c1b59fa
Add ability to define default request properties
rstoyanchev Sep 15, 2012
f61be34
Refine pathInfo algorithm
rstoyanchev Sep 20, 2012
c52b3a8
Upgrade json-path dependency from 0.5.5 to 0.8.1
rstoyanchev Sep 20, 2012
ba7d945
Replace hamcrest-library 1.2.1 with hamcrest-all 1.1
rstoyanchev Sep 20, 2012
59a23c9
MockMvcBuilders return concrete implementation
rwinch Sep 14, 2012
cea3bf7
Added Spring Security Sample
rwinch Sep 14, 2012
594809a
Polish Spring Security tests
rstoyanchev Sep 20, 2012
0f52aa6
Polish RequestBuilders
rstoyanchev Sep 21, 2012
8ef6b7e
Polish RequestBuilder extension point
rstoyanchev Sep 22, 2012
f971a2d
Polish Javadoc
rstoyanchev Sep 21, 2012
b97e047
Polish server-side support
rstoyanchev Sep 22, 2012
0cc7341
Update Javadoc
rstoyanchev Sep 22, 2012
0449d60
Add SecurityRequestPostProcessors to sample tests
rwinch Sep 24, 2012
6b9a39f
Merge pull request #70 from rwinch/securityrequestpostprocessor
rstoyanchev Sep 24, 2012
d3560f9
Rename unit test to match renamed class under test
rstoyanchev Sep 24, 2012
486b5dd
[artifactory-release] Release version 1.0.0.M2
spring-builds Sep 25, 2012
dd88b2c
Increment version to 1.0.0.BUILD-SNAPSHOT
rstoyanchev Sep 25, 2012
b789cce
Add stub method to MockWebApplicationContext
rstoyanchev Sep 26, 2012
b162461
Polish
rstoyanchev Oct 12, 2012
5606856
Add method to MockMvcRequestBuilders
rstoyanchev Nov 26, 2012
015d94f
Fix issue from last commit
rstoyanchev Nov 26, 2012
4584e91
Update README
rstoyanchev Dec 12, 2012
14aa4c3
Updated README
rstoyanchev Dec 12, 2012
6c02c27
Update README
rstoyanchev Dec 12, 2012
4cdcf50
Fix comment
Sep 19, 2014
e4ff444
Merge pull request #84 from mrcmatuszak/master
rwinch Sep 19, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 19 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,27 @@

Spring MVC Test Support
=======================
This project facilitates testing _Spring MVC_ server-side and client-side _RestTemplate_-based code.

The goal of this project is to faciliate the creation of integration tests for _Spring MVC_ applications. At present it contains server-side support only but will have client-side support added as well.
__NOTE: The project is now incorporated in the spring-test module of Spring Framework 3.2. Applications building against Spring Framework 3.1.x can continue to use this standalone project. However, applications building with Spring Framework 3.2 should use the spring-test module of Spring Framework 3.2 instead. See the Spring Framework [reference guide](http://static.springsource.org/spring-framework/docs/3.2.0.BUILD-SNAPSHOT/reference/htmlsingle/#spring-mvc-test-framework) for more details.__

This code is intended for inclusion in the `spring-test` module of the __Spring Framework__. Its present home here allows us to evolve it on a flexible release schedule and with community feedback potentially accommodating a wide range of scenarios.
To get started, see sample [server-side](spring-test-mvc/tree/master/src/test/java/org/springframework/test/web/server/samples) and [client-side](spring-test-mvc/tree/master/src/test/java/org/springframework/test/web/client/samples) tests. The [spring-mvc-showcase](https://github.com/SpringSource/spring-mvc-showcase) project also has many sample tests.

Server-Side
===========
Milestone 2 can be obtained through the
http://repo.springsource.org/libs-milestone repository.

Overview
--------
Annotated-controllers depend on Spring MVC to handle many things such as mapping requests, performing data binding and validation, setting the response status, writing to the body of the response using the correct content type, and many more.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test-mvc</artifactId>
<version>1.0.0.M2</version>
<scope>test</scope>
</dependency>

To test all that you may instantiate an in-memory Servlet container driving requests with _JWebUnit_ or you may use a test tool such as _JMeter_ or _Selenium_. These options however require running a Servlet container and can only perform black-box testing.
The latest snapshot can be obtained through the http://repo.springsource.org/libs-snapshot repository.

The aim of this project is to provide a more "lightweight" and more integrated alternative by building on the familiar `MockHttpServletRequest` and the `MockHttpServletResponse` from the `spring-test` module and without the need for a Servlet container. Whether you want to point to one controller or to test with your complete web application context setup, it should be easy to send a request and verify the results.

Examples
--------

Test an `@ResponseBody` method in a controller:

MockMvcBuilders.standaloneMvcSetup(new TestController()).build()
.perform(get("/form"))
.andExpect(status(200))
.andExpect(contentType("text/plain"))
.andExpect(responseBody("content"));

Test binding failure by pointing to Spring MVC XML-based context configuration:

MockMvcBuilders.xmlConfigMvcSetup("classpath:org/examples/servlet-context.xml").build()
.perform(get("/form"))
.andExpect(status(200))
.andExpect(modelAttributesWithErrors("formBean"))
.andExpect(viewName("form"));

Test serving a resource by pointing to Spring MVC Java-based application configuration:

MockMvcBuilders.annotationConfigMvcSetup(TestConfiguration.class).build()
.perform(get("/resources/Spring.js"))
.andExpect(contentType("application/octet-stream"))
.andExpect(responseBodyContains("Spring={};"));

For more examples see tests in the [org.springframework.test.web.server](spring-test-mvc/tree/master/src/test/java/org/springframework/test/web/server) package.

Limitations
-----------

Most rendering technologies should work as expected. For _Tiles_ and _JSP_, while you can test with your existing configuration as is, no actual JSP-based rendering will take place. Instead you should verify the path the request was forwarded to (i.e. the path to the JSP page) or you can also verify the selected view name.

Contributions
=============

If you see anything you'd like to change we encourage taking advantage of github's social coding features by making the change in a [fork of this repository](http://help.github.com/forking/) and sending a pull request.

To report an issue the Spring Framework forum or the Spring JIRA creating requests under the component _"SpringTEST"_.

Before we accept a non-trivial patch or pull request we will need you to sign the [contributor's agreement] (https://support.springsource.com/spring_committer_signup). Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

Acknowledgements
================

This project draws inspiration from similar [server-side](http://static.springsource.org/spring-ws/sites/2.0/reference/html/server.html#d4e1487) and [client-side](http://static.springsource.org/spring-ws/sites/2.0/reference/html/client.html#d4e1860) test support introduced in Spring Web Services 2.0.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test-mvc</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<scope>test</scope>
</dependency>

This project is available under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0).
Loading