Hi all,
Recently I was writing some tests and needed to check the HTTP status code for some requests. In doing so I started out trying to reuse code from the ows module's tests, but found that it used
com.mockobjects.servlet.MockHttpServletResponse while my tests (and GeoServerAbstractTestSupport) are using com.mockrunner.http.HttpServletResponse . I've already worked around this, but I wonder whether it would be useful to unify the tests around a single mock framework. Is there any reason to be using both of these?
(By the way, if anyone else needs to check status codes there are assertions in GeoServerAbstractTestSupport for that now, just do:
assertStatusCodeForGet(200, "welcome.do");
assertStatusCodeForPost(500, "ows", "this isn't xml!", "text/xml");
assertStatusCodeForPut(501, "welcome.do", "GeoServer homepage", "text/plain");
etc.)
-David Winslow
David Winslow wrote:
Hi all,
Recently I was writing some tests and needed to check the HTTP status code for some requests. In doing so I started out trying to reuse code from the ows module's tests, but found that it used
com.mockobjects.servlet.MockHttpServletResponse while my tests (and GeoServerAbstractTestSupport) are using com.mockrunner.http.HttpServletResponse . I've already worked around this, but I wonder whether it would be useful to unify the tests around a single mock framework. Is there any reason to be using both of these?
Hmmm... probably just a result of my sillyness :). Yeah I definitely would like to just use one framework if we can. Any idea how much work it will be to reconcile them?
(By the way, if anyone else needs to check status codes there are assertions in GeoServerAbstractTestSupport for that now, just do:
assertStatusCodeForGet(200, "welcome.do");
assertStatusCodeForPost(500, "ows", "this isn't xml!", "text/xml");
assertStatusCodeForPut(501, "welcome.do", "GeoServer homepage", "text/plain");
etc.)
Nice :).
-David Winslow
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
!DSPAM:4007,484fd28310591637810514!
--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com
Probably not that much, most tests just use HttpServletResponse and don't worry about the implementation. It looks like there are only two classes outside of community using mockrunner directly (although one of those, GeoServerAbstractTestSupport, uses it extensively) and two classes using mockobjects. I tried a simple find-and-replace but the tests didn't compile after that; so a bit of tweaking by hand would be required. I guess the question at this point is which framework we want to unify around.
MockRunner is the one we are currently using, even if most tests don't explicitly require it. However, it looks like MockObjects has better objects (for example, it seems that mockrunner has no support for verifying the status code, I ended up using an HttpServletResponseWrapper to capture the status code as it's set for my implementation). I guess switching over GeoServerAbstractTestSupport would be a fair bit work if we decided to switch over from mockrunner; but I think it would only be a couple of hours max either way.
-David
Justin Deoliveira wrote:
David Winslow wrote:
Hi all,
Recently I was writing some tests and needed to check the HTTP status code for some requests. In doing so I started out trying to reuse code from the ows module's tests, but found that it used
com.mockobjects.servlet.MockHttpServletResponse while my tests (and GeoServerAbstractTestSupport) are using com.mockrunner.http.HttpServletResponse . I've already worked around this, but I wonder whether it would be useful to unify the tests around a single mock framework. Is there any reason to be using both of these?
Hmmm... probably just a result of my sillyness :). Yeah I definitely would like to just use one framework if we can. Any idea how much work it will be to reconcile them?
(By the way, if anyone else needs to check status codes there are assertions in GeoServerAbstractTestSupport for that now, just do:
assertStatusCodeForGet(200, "welcome.do");
assertStatusCodeForPost(500, "ows", "this isn't xml!", "text/xml");
assertStatusCodeForPut(501, "welcome.do", "GeoServer homepage", "text/plain");
etc.)
Nice :).
-David Winslow
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel