Contributions
Re: Test step to wrap an arbitrary resource as a Request
Nenad - Thanks for the reply. Perhaps I don't understand your suggestion or I wasn't clear about what I need to do. I need to submit a request containing lots of parameterized data, then check 3 databases to ensure that the submitted data was inserted properly. I can't query the DBs in advance. I have created Mock Services that return XML result sets, and then post requests to them and assert on the submitted parameters, but I thought a step that would encapsulate a simulated request functionality for different resources (eg. JDBC) would be handy. - Michael583Views0likes0CommentsRe: Mock Service response wrapped in CDATA tag when embedding CDATA
I've gotten this to work with the CDATA section. I set the response content-type to "application/xml" and placed the CDATA section in a closure: import groovy.xml.MarkupBuilder def response = mockRequest.getHttpResponse() response.setContentType("application/xml") def writer = response.getWriter() def xml = new MarkupBuilder( writer ) xml.result { detail() { xml.yieldUnescaped("<!CDATA[" + "Some text" + "]]>") } } writer.close()1.3KViews0likes0CommentsMock Service response wrapped in CDATA tag when embedding CDATA
I am using the OnRequest script in a Mock Service to return XML constructed with MarkupBuilder. When I do the following: import groovy.xml.MarkupBuilder def writer = mockRequest.getHttpResponse().getWriter() def xml = new MarkupBuilder( writer ) xml.result { detail("Some text") } writer.close() I get this response: <result> <detail>Some text</detail> </result> which is as desired. If however I embed CDATA in the response like so: detail( xml.yieldUnescaped("<!CDATA[" + "Some text" + "]]>")) I get the following: <data contentType="null" contentLength="63"><![CDATA[<result><!CDATA[Some text]]> <detail /> </result>]]></data> Why the inconsistent response? Thanks.2.6KViews0likes2CommentsRe: Set Mock response from groovy script that talks to JMS?
No answers for you but interesting as I posted a similar question a few days after you. I need to to DB validation after interacting with a WS and I would like to have a test step that could use JDBC as a resource and be able to use the standard request assertions against the result set.982Views0likes0CommentsTest step to wrap an arbitrary resource as a Request
I currently have a need to verify DB contents after submitting a request. I know this can be done with Groovy script, but I think it would be useful to have a test step that could wrap a resource like a JDBC connection as if it was a Request and allow the standard Request assertions to be applied to the result. I've thought about implementing in the OnRequest script of a mock service, but this would be a global resource rather than an isolated component in a script.1.6KViews0likes2Comments